Jump to content

Recommended Posts

I have a script that is to search a DB for matching critera.  It works, but I think its running slower than it should be.

 

The first query I run is:

$query = "SELECT * FROM ".$table." ".$critera." ".$orderby; 

that works to get me all matching results.

 

My question is what is stored in that query.  If it matches say 5 (row a,b,c,d,e) and i want to use the results of rows a,b,c later down to populate the matching results.  Can i Do this with out requerying?

Link to comment
https://forums.phpfreaks.com/topic/52129-solved-mysql-optimization-question/
Share on other sites

$query = "SELECT 'ID' FROM ".$table." ".$critera." ".$orderby;

 

$result=mysql_query ($query); //Return ofthe Number of Matching Results

 

Didnt' work

but later on I say:

do
{
          $adid_array[$i] = $row['ID'];
	  $i++;
    }
  while( $row= mysql_fetch_array($result));

 

any idea?

yeah i think you initially misunderstood me a,b,c are the actual rows i need out of the matching rows a-e so select a,b,c would not work but anyways its a big improvement for now.  It could use a second optimization, but for now and its current function its good.

 

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.