Jump to content

Recommended Posts

I got to thinking late last night (which generally leads to trouble), so please be gentle if some educating is in order, as I suppose I will touch a few related issues.

 

As I develop my database, I will include two seperate columns.  One for the time/date that an order was placed.

A second for the time/date that an order is updated (unless there's a better way, please inform me).

 

I pressume that if a record is updated several times, it will continually overwrite the time/date to the point that I will only see the latest update.  Now I was wondering if I could create a third column to keep count of the number of times a record had been updated, so if it were altered 16 times, I would know when the last update occurred, and have the count number also.

 

Will something like this coding work?

 

SELECT updates FROM myTable WHERE id="$id"

$updates =n

if n<1, n=1

}else{ n++

 

Link to comment
https://forums.phpfreaks.com/topic/258137-count-number-of-updates/
Share on other sites

Isn't that what I did.

Are you trying to be a wiseguy and waste my time, or do you have an actual solution to suggest to improve my code?  If so, please POST IT!

 

I'm not going to write code for you, sorry. If you already did it, then this topic is finished.

I think you should increment a field every time an UPDATE query is executed. It can all be done at one time; there's no need for a SELECT query ahead of time. The syntax is here: http://dev.mysql.com/doc/refman/5.0/en/update.html in the third grey highlighted code block.

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.