473,564 Members | 2,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=$vari able++ 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 1591
NDS Ltd wrote:
i would normally read the value out of the database, assign to a variable,
then to $variable=$vari able++ 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**********@y ahoo.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=$vari able++ 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
1915
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 tried a number of variants tied to the before update event, but always get the message "The field 'tripmain.trip_number' can't contain a Null value...
26
4084
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
1800
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, but only logging modified fields, and he wants me to do this wing postgres pgSQL triggers. We are given 10 automatically created variables. Some...
6
2527
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 and Shift-Tab for navigation. Each field in the form is numerical, and has certain properties; for example, one field represents %, and has a min...
3
2254
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 http://support.microsoft.com/default.aspx?scid=kb;en-us;Q320731 but the workaround prescribed in the KB isn't particularly helpful. The project I'm working on serves up a custom jpg image on...
5
3445
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 table called , with a field named . The general format for this number is supposed to be (yyyy-0001). The last 4 digits are supposed to increment...
14
8957
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 data inserted, but one problem is now that when I add a new user it doesn't increment.. Is there any way with VBA, that I can grab the last CustomerID...
1
3500
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 trying to do: I have a Form that has a subform. My primary form has a field that autonumber and this field has a one to many relationship to a field in my...
3
4665
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 subform is tied to the main form by Project_ID. I want the Sequence field to automatically increment each time I add a new record. I can't use the...
0
7666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.