RE: [PHP] PHP and MySQL
| From: | Craig Vincent | Date: | Thu, 16 May 2002 12:25:34 +0000 |
| Subject: | RE: [PHP] PHP and MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97898@lists.php.net to get a copy of this message | ||
> mysql_select_db( $db, $link )
>
> or die ( "Couldn't open the $db: ".mysql_error() );
>
>
> if ($submit){
>
> if( $booktitle AND "quantity" ){
>
> $sql = "UPDATE Book2 SET stock ='$stock-quantity' WHERE
> booktitle='$booktitle' AND quantity=quantity";
>
> }
Easy enough =) You're not running the mysql query =) You're never sending
a command to MySQL to tell it to execute the $sql statement
if( $booktitle AND "quantity" ){
$sql = "UPDATE Book2 SET stock ='$stock-quantity' WHERE
booktitle='$booktitle' AND quantity=quantity";
mysql_query($sql);
}
Should do the trick. Or even cleaner
if( $booktitle AND "quantity" ){
mysql_query("UPDATE Book2 SET stock ='$stock-quantity' WHERE
booktitle='$booktitle' AND quantity=quantity");
}
Sincerely,
Craig Vincent