Uh, what's the question (I didn't read the other posts). If you want to know how to get the product id for the second query, it will just be the value of the result array with the key 'productid' (assuming you got an associative array from the first query).
ie, "SELECT count(*) FROM picture WHERE productid='". $row['productid']."' AND (field 'pic' blob size) > 0 LIMIT 1" Obviously, if the result is 1, you've got something, otherwise 0. Note that you need to escape $row['productid'] properly. Note also that it is better to use a proper SQL escaping function rather than addslashes eg mysql_real_escape_string() On Nov 4, 11:34 am, Michael <[EMAIL PROTECTED]> wrote: > Thanks kindly to the people who have contributed so far however may be I > haven't quite explained it right so here goes again- > > I have the following query- > > "SELECT productid,title FROM product WHERE > categoryid='".addslashes($_GET[cid])."' AND display='1' ORDER BY title ASC > LIMIT $st,$pp" > > The above is a loop, it can return multiple results. > > I want to run a sub query to obtain further information, with the 'select' > criteria being based on the result of 'productid' above, like- > > "SELECT count(*) FROM picture WHERE productid='(productid from the last > query)' AND (field 'pic' blob size) > 0 LIMIT 1" > > In the sub query I just want to know if a row *exists* and use this to switch > a PHP 'if' statement. > > FYI - 'pic' is a BLOB field containing an image. > > Michael --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [EMAIL PROTECTED] -~----------~----~----~----~------~----~------~--~---
