471,083 Members | 1,176 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,083 software developers and data experts.

incrementing a value in a field

Hi,

**newbie alert**

i want to update a value in a database.

i would normally read the value out of the database, assign to a variable,
then to $variable=$variable++ then use an update statement to set the new
value in the table..

is there an easier way to increase a fields value by one in a single query?

many thanks

sean

Jul 20 '05 #1
2 1510
NDS Ltd wrote:
i would normally read the value out of the database, assign to a variable,
then to $variable=$variable++ then use an update statement to set the new
value in the table..

is there an easier way to increase a fields value by one in a single query?


# for example like this:
update yourtablename set yourcolumnname=yourcolumnname+1 where id=1;
Jul 20 '05 #2
thanks mate that worked a treat!

--
Sean Browne
NDS Ltd / Connections
07971 175 354
"Aggro" <sp**********@yahoo.com> wrote in message
news:0x************@read3.inet.fi...
NDS Ltd wrote:
i would normally read the value out of the database, assign to a variable, then to $variable=$variable++ then use an update statement to set the new value in the table..

is there an easier way to increase a fields value by one in a single
query?
# for example like this:
update yourtablename set yourcolumnname=yourcolumnname+1 where id=1;

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by Bas Wassink | last post: by
2 posts views Thread by Tim Vadnais | last post: by
6 posts views Thread by Captain Dondo | last post: by
3 posts views Thread by Adam Sandler | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.