Forum Moderators: coopster
so i have this:
$query="select * from TABLE where ARGUMENTS";
$result=mysql_query($query);
while ($myrow=mysql_fetch_array($result)){
I then want to say:
$query2="select * from $result ARGUMENTS";
$result2=mysql_query($query2);
while ($myrow2=mysql_fetch_array($result2)){
echo ('etc...
in order to refine the selection. How do i go about instructing mysql to select only from the results of the first query?
thanks
Alternatively you could write the results of the first query to a temporary table and then query that temporary table. Thatīs still way faster than retrieving the first result and process it using PHP. Although that will depend on what that processing would involve. It it is rather simple just go with Nickīs suggestion.
Andreas
Andreas, you bring up a point I've been wondering about for a while now. Optimization of a web app for speed. Where does one go (book title, web page, etc...) to get a handle on speed of one method versus another? In reading through the MySQL site and PHP.net I haven't really come across a good explanation or suggested practices.
For instance, Andreas noted that it's faster to create a temporary table and query that than it is to use PHP to parse through the result set of the first query. I would have thought the opposite to be true!