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

I am currently achieving what i want with the following code-

$result1 = mysqli_query($link,"SELECT productid,title FROM product WHERE
categoryid='".addslashes($_GET[cid])."' AND display='1' ORDER BY title ASC 
LIMIT $st,$pp") or die ('Query sql1 failed');

while ($aryG1 = mysqli_fetch_assoc($result1)) {
while (list($keyG1,$valG1) = each($aryG1)) {$$keyG1 = $valG1;}

$res=mysqli_query($link,"SELECT count(*) AS xyz FROM picture WHERE 
productid='$productid' AND pic !=''") or die ('Query sql1a failed');
while ($row3=mysqli_fetch_assoc($res)) {
$xyz=$row3["xyz"];};

What I want to do is have one SQL query and obtain value $xyz in one swoop 
with the other values (productid and title).

$productid is the same on both tables.

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to