Jump to content

Recommended Posts

Ok here's my problem,  I have a second query happening inside another While loop and I want it to grab info for the corresponding entry.  I can get it to work fine if there is and entry available.  So what do i do when the matching entry is not available.  I don't care that value is missing.  That's expected.  What I'm looking for is how handle the lack of the entry to specify the variables I want.

$final = mysql_query("SELECT tickets.item, tickets.amount, tickets.paypal FROM tickets WHERE tickets.item = $id"); //SECOND QUERY ON INCLUDE FILE
while ($row2=mysql_fetch_array($final)) {  //IF $id VALUE IS NOT MATCHED  I WANT $amount AND $paypalID TO = 0
$amount = $row2['amount'];
$paypalID = $row2['paypal'];}
if ($amount>0 && $paypalID>0){
echo $amount;
$over= '<font size=4 color="red"><br>sold!</font>';
echo $over;
$stop= "86";}
elseif ($hrdif>$hours) {
$payprice=$row['loprice'];
echo $payprice;
$over= '<font size=4 color="red"><br>sale over</font>';
echo $over;
$stop= "86";
//$userCut=$payprice*0.98;  -also on paypalIPN.php.  HERE FOR TESTING.
//echo $userCut;
}
else {
//echo "current price: ";
$payprice=round($row['price']-$hourly*$hrdif, 2);
echo $payprice;
$over= "";
$stop= "0";
}

Link to comment
https://forums.phpfreaks.com/topic/237289-if-query-gets-no-result-do-what/
Share on other sites

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.