Re: Forms and mysql

From: Date: Fri, 05 Apr 2002 02:22:36 +0000
Subject: Re: Forms and mysql
Groups: php.general 
Request: Send a blank email to php-general+get-91654@lists.php.net to get a copy of this message
I don't understand what the curly brackets are for in this query.. I don't ever use them and it seems to work fine without them over here.. But I don't know if that's where you are having.the trouble.. "]=("UPDATE {$config["prefix"]}_items set quantity =quantity - 1 WHERE id = '$ItemID'"); I don't thing the quantity - 1 part will work in a query like that will it? Suggest: $quantity -= '1'; "]=("UPDATE {$config["prefix"]}_items set quantity =$quantity WHERE id = '$ItemID'"); At the very simplest, it seems that the $ on =quantity would be necessary too.. Hope this jogs something.. Bob Weaver "Jennifer Downey" <jendowney@attbi.com> wrote in message news:20020404235600.75326.qmail@pb1.pair.com... > Hi all, > > I know I've asked this before and wouldn't be asking again if I had the > email that you people replied back with. Windows took a you know what on me > and I had to format the hard drive. > > Anyway here is what I have. > > This is items.php: > <form action='buyitem.php' method='post'> > <? > $query = "SELECT id, image, name, quantity, price FROM > {$config["prefix"]}_items where id = 1"; > $ret = mysql_query($query); > $return = mysql_fetch_array($ret); > > > echo "<input type='image' > src='images/blueholo.gif'><br>"; > > echo "<b>$return[name]</b><br>"; > echo "Quantity $return[quantity]<br>"; > echo "Cost: $return[price] SC<br>"; > echo "<input type='hidden' name='ItemID' > value='$id'>"; > ?> > </form> > > What I need to accomplish is that when the submit button is clicked the > quantity is subtracted by 1 and then the item is placed in the users item > list in mysql. > > This is what I have in buyitem.php but I cant seem to get it to work. > $return["quantity"]=("UPDATE {$config["prefix"]}_items set quantity = > quantity - 1 WHERE id = '$ItemID'"); > $result=mysql_query($db["quantity"]); > > Would someone be kind enough to help with this? > > > Thanks for all your help so far. > And thanks in advance. > Jennifer > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#91654) next »