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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mysql-Returning 2 queries on the same page

Status
Not open for further replies.

brandonbob

Technical User
Nov 16, 2000
3
US
I apologize for asking what is probably a simple question, but I have been unable to find relief for my headache!

I am attempting to display the results of 2 'select' queries in 2 separate tables on the same page. I am using

For both queries I use:

1) $result= mysql_query(SELECT...)
2) while ($myrow = mysql_fetch_array($result)
3) table definition with $myrow('fieldname')
4) mysql_free_result

I can run both of the 2 independently without any problems. However, when I try to get them both to work at the same time, the first table vanishes and all the results are stored in the second table. I have tried each of the following so far:

1) changing the varaible on the 2nd query to $myrow2
2) separating the 2nd query into its own function
3) separating the 2nd query into its own script

Can someone help me out? Thanks in advance for any assistance.
 
It would be much easier to understand what you are saying if you had posted your code. Due to lack of understanding, my guess is that you are using the same variable names on both queries. Try using $res1 and $res2 instead of $result and on anything else you have doubled up. Just a guess.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top