RE: [PHP-DB] Updating Many Records oops
| From: | Peter Lovatt | Date: | Thu, 18 Apr 2002 23:29:28 +0000 |
| Subject: | RE: [PHP-DB] Updating Many Records oops | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18663@lists.php.net to get a copy of this message | ||
Dont think it made sense last time (too little coffee, too much work!)
try again
IF there is a formula for the value of quantity eg Quantity = Quantity -1
(UPDATE table SET Quantity = Quantity-1 )
IF there is no formual you need to do an update statement
for each row
EG
UPDATE table SET Quantity = "2" WHERE Field = Book1
UPDATE table SET Quantity = "4" WHERE Field = Book2
UPDATE table SET Quantity = "9" WHERE Field = Book3
HTH
Peter
-----------------------------------------------
Excellence in internet and open source software
-----------------------------------------------
Sunmaia
www.sunmaia.net
info@sunmaia.net
tel. 0121-242-1473
-----------------------------------------------
> -----Original Message-----
> From: Peter Lovatt [mailto:pjln1@sunmaia.net]
> Sent: 18 April 2002 23:30
> To: Bzdpltd@aol.com; php-db@lists.php.net
> Subject: RE: [PHP-DB] Updating Many Records
>
>
> IF there is a formula for the value of quantity eg Quantity = Quantity -1
> (UPDATE table SET Quantity = Quantity-1 ) you need to do an
> update statement
> for each row
>
> EG UPDATE table SET Quantity = "9" WHERE Field = Book3
>
> HTH
>
> Peter
>
> -----------------------------------------------
> Excellence in internet and open source software
> -----------------------------------------------
> Sunmaia
> www.sunmaia.net
> info@sunmaia.net
> tel. 0121-242-1473
> -----------------------------------------------
>
> > -----Original Message-----
> > From: Bzdpltd@aol.com [mailto:Bzdpltd@aol.com]
> > Sent: 18 April 2002 14:21
> > To: php-db@lists.php.net
> > Subject: [PHP-DB] Updating Many Records
> >
> >
> > I am not sure if this is possible.
> >
> > I have a database, and we fetch all the records and then list them.
> >
> > What we need is the one field in the database to be able to be updated.
> >
> > Now the field will have different values for each record. Is it
> > possible to update the table with lots of different values?
> >
> > So for example we have:
> >
> > Field Qantity
> > Book 1 5
> > Book2 6
> > Book3 9
> >
> > Now when we are shown all these records the quantity is a form
> > field and we want to change this but for each record?
> >
> > Hope the above is enough to go on.
> >
> > Barry
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>