RE: [PHP] PHP and mySQL
| From: | Craig Vincent | Date: | Tue, 14 May 2002 11:21:17 +0000 |
| Subject: | RE: [PHP] PHP and mySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97520@lists.php.net to get a copy of this message | ||
<snip>
}else if(!$submit){
</snip>
Acthough you didn't show 75 lines of code my guess would be your problem
lies here. The else and the if shouldn't have a space between them.
} elseif(!$submit){
See how that works for you =)
Also your SQL is faulty
<snip>
$sql = "UPDATE Book2 SET stock ='$stock-quantity' WHERE booktitle=$booktitle
AND quantity=quantity";
</snip>
$booktitle I'm 99.9% certain is not an integer. Therefore you need single
quotes around it. And the condition quantity=quantity is a tad redundant
since quantity would always equal itself =) I suspect you meant
quantity=$quantity (again if it's not an integer you need single
quotes....heck put single quotes around it anyways...it doesn't hurt)
$sql = "UPDATE Book2 SET stock ='$stock-quantity' WHERE
booktitle='$booktitle' AND quantity='$quantity'";
Sincerely,
Craig Vincent