Jump to content

Recommended Posts

I am writing a poll script.  I have an integer field in my DB, and i want to just open the DB, increment a value, and then display the results.  Currently i've got three query's running; one to get the current data, one to UPDATE the current data, and one to display the changed data.

 

This seems really rubbish to me.  There must be a way to increment an INT field in a DB simply by using SQL.  Can anyone help? I just need to plus one.

 

I've looked around and i can't find anything on the subject, or maybe im just not searching the right thing.  Anyway, please help.

 

~Chud37

Link to comment
https://forums.phpfreaks.com/topic/215691-easy-one-supposedly-increment-value/
Share on other sites

oh my.

 

I searched around and did not find any answers on this, i cant believe it is as simple as that! but it works.  Thanks!

 

p.s - i suppose i can perform all the other operations and do some fun algebra in SQL queries? i.e. fld=((fld+1)*5)/4 ?

 

Not that i want to in this point in time, but that would be legal, would it?

 

:)

 

Sorry for asking silly questions, like i said i couldnt find any documentation on it.

 

Thanks,

 

~Chud37

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.