[php/mysql] Query wil maar niet lukken

Pagina: 1
Acties:
  • 27 views sinds 30-01-2008

  • Thomasje
  • Registratie: Augustus 2002
  • Laatst online: 29-05-2024
Ik zit heel de tijd te kloten en krijg het maar niet voor elkaar om de volgende 3 queries om te toveren in 1 query.

PHP:
1
2
3
4
5
6
7
8
9
10
$sql_user = "SELECT user FROM vacatures WHERE vacatures_ID='$Item_ID'";
$result_user = mysql_query($sql_user);
$row_user = mysql_fetch_array($result_user);

$sql_groep = "SELECT groep_ID FROM users WHERE user_ID = $row_user[user]";
$result_groep = mysql_query($sql_groep);
$row_groep = mysql_fetch_array($result_groep);

$sql_mail = "SELECT email FROM users WHERE groep_ID =$row_groep[groep_ID]";
$result_mail = mysql_query($sql_mail);

  • justmental
  • Registratie: April 2000
  • Niet online

justmental

my heart, the beat

Wat je zoekt zijn zgn. inner joins.
Zie: P&W FAQ - SQL

Who is John Galt?


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

Nee, wat hij zoekt is een betere manier om topics te starten.
P&W FAQ - De "quickstart"

Mocht je er niet uit komen met de tip van justmental, dan mag je een nieuw topic openen, maar hou je dan wel aan de quickstart. In zijn huidige vorm is dit topic gewoon een scriptrequest, en die hoeven we hier niet. :)

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Dit topic is gesloten.