Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL Multiple Queries

Status
Not open for further replies.

salewit

Programmer
Oct 31, 2002
58
US
I'm fairly new to MySQL and very new to PHP. I'm trying to access multiple tables, but it's just too hairy for me to do in one call. But I tried multiples and it isn't working.

This message here further confuses me:

Here's a quick and simplified look at it. Is there anything that would prevent me from doing this? I realize the mysql_fetch_assoc would be put in a loop. I should mention that if I comment out the first 2 queries, I get about 20 rows of data. When I put the 2 queries in, I get just one row, but the $number_of_rows shows a totally bogus number (like 2200 or something).

Thanks

$linkID = @mysql_connect("localhost","user","pw");

mysql_select_db ("db",$linkID);
$resultID = mysql_query($select_statement_1,$linkID);

$x=mysql_fetch_assoc($resultID);

$resultID = mysql_query($select_statement_2,$linkID);

$y=mysql_fetch_assoc($resultID);

$resultID = mysql_query($select_statement_3,$linkID);

$z=mysql_fetch_assoc($resultID);

$numer_of_rows = mysql_num_rows($resultID);
 
Hmmm oh jeez... never mind. It does work. I was re-using a loop variable inside the loop. Never mind.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top