473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 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 1582
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: K. Davis | last post by:
I need to increment the maximum value of a field of a table by 1 when a form opens a blank record. (e.g. =max(!![trip_number}) so the logic and references are working at the form level. I've...
26
by: Bas Wassink | last post by:
Hi there, Does the ANSI standard say anything about incrementing variables past their limits ? When I compile code like this: unsigned char x = 255; x++; printf ( "%d\n", x );
2
by: Tim Vadnais | last post by:
Hi, My boss wants to add some logging functionality to some of our tables on update/delete/insert. I need to log who, when, table_name, field name, original value and new value for each record,...
6
by: Captain Dondo | last post by:
I've got an embedded system that uses a javascript-enabled browser as a front end. The input system consists of an encoder which generates + and - chars, and a couple of keys that generate Tab...
3
by: Adam Sandler | last post by:
Hello, I'm able to reproduce my problem but I haven't been able to figure out why it is happening. MS does have an article about such behavior in...
5
by: tcveltma | last post by:
Hi Everyone, I know this topic has been posted a lot, so I apologize for having to post another one, but the answers I've been finding seem to be more advanced than I know how to use. I have a...
14
by: helraizer1 | last post by:
I have a database with 4 tables: tblMembers, tblRides, Session table and Reservation table. One of the fields in the Members table is set to number, but now I have all relationships set up and the...
1
by: asandiego | last post by:
Hey guys, this is my first post here but have been checking this site a lot for anything I need. I hope someone can lead me to what I should do or just an idea to what can be done. What I'm...
3
by: bkberg05 | last post by:
Hi - I have a field called Sequence on a continuous subform. The Sequence field belongs to a table called Project_Draw. This table has many 'Draw' records for each 'Project' record. So then the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.