Jump to content

Recommended Posts

I get 500 over and over from server before getting a successful one. Db is not that big.

 

Any clue greatly appreciated.

 

$query="SELECT * FROM table1 WHERE condition";  

$results=mysql_query($query);
   
   
   while($row = mysql_fetch_array($results, MYSQL_ASSOC))
{
   
          $query2="SELECT * FROM table2 WHERE condition2";  
          $results2=mysql_query($query2);

Errr....  We'll need more code to know for sure, and EXPLAIN results on any queries involved.  Can the two queries be combined using a JOIN?

 

Thanks corbin. So there's nothing wrong with the code...

 

I can't because one depends on the results of the first one. When run alone both are very fast. When together, I get a 500!

 

 

If table1 doesnt have any BLOB fields, ill bet you any money it in the looping queries

 

$query2="SELECT * FROM table2 WHERE condition2"; 
$results2=mysql_query($query2);

 

Do you have to select all from table2? Can you select only the fields you want eg. SELECT name,description FROM table2? And does the table have any BLOB or large fields in it?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.