Jump to content

[SOLVED] MySQL optimization question


cooldude832

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.