Re: PHP and mySQL
| From: | David Robley | Date: | Tue, 14 May 2002 11:08:32 +0000 |
| Subject: | Re: PHP and mySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97518@lists.php.net to get a copy of this message | ||
In article <OIBBKNAFKLNGCMHCDGIKKEGHCDAA.sullivan@ccc-e.net>,
sullivan@ccc-e.net says...
> I am getting a parse error on line 75. I am trying to say:
>
> if there is a booktitle and a quantity chosen, then go to that booktitle and
> adjust the quantity in the database.
>
> Thanks!
> Renee
>
>
> <?php
> $user = "adminer";
> $pass = "hoosiers";
> $db = "Book Store1";
> $local = "jolinux";
> $link = mysql_connect( "$local", $user, $pass );
> if (! $link )
> die ( "Couldn't open the database" );
> mysql_select_db( $db, $link )
> or die ( "Couldn't open the $db: ".mysql_error() );
>
> if ($submit){
> if( $booktitle, "quantity" ){
> $sql = "UPDATE Book2 SET stock ='$stock-quantity' WHERE booktitle=$booktitle
> AND quantity=quantity";
> }
> // $result = mysql_query($mysql);
> }else if(!$submit){
> echo "Your order has not been placed.<p>";
> }
> ?>
> </BODY>
> </HTML>
There don't seem to be 75 lines there? But I think you _might_ be missing
a closing }
I suspect you will then encounter problems with your SQL: you might want
to add mysql_error() after your update call, and ensure that the variable
you are using as your sql query is the variable you have assigned the sql
query to :-)
--
David Robley
Temporary Kiwi!
Quod subigo farinam