Jump to content

PHP Original and New Value


kamal213

Recommended Posts

Hi Guyz,

 

I have a PHP script which updates sales values in my customer management database.

 

The problem is I've been asked to echo both the original value and the newly updated value and I have no idea to do this.

 

Please guyz could you advise me on how to solve this problem.

 

Thanks.

Link to comment
Share on other sites

well, you could add a new column to your DB table so this way the original always stays the same in then with the new column keep the updated new value there. So now when you query the DB you can query for both with ease. Unless you have some other concept at hand here that's not explained this option sounds the easiest all around.

Link to comment
Share on other sites

With sessions.. no.. sessions only last a temporary amount of time on the server, and cookies would be just as bad cause they only store on your local machine and if you wipe your history or anything else the data is lost. and in both cases the cookies would have to be some what elaborate in storing so you can store them all.

 

this is why I say add an extra column to the table your querying where you can leave your quote unquote original price alone, and then have the other row update regularly with the new updates.

 

If you change your prices often and want to keep a history of that then make an all new table in your database where you keep your product id the same as on the other table and then add a datetime column, and pricechange column to it so you can poll results from that table and the first table to your desire..

Link to comment
Share on other sites

Well that's dependent upon how you choose to UPDATE your table.. You can choose to update where one column goes to the other and the new value gets inserted so to speak. Or you can leave the original the same til the day you take down the site. That part of it is not automated in any sense, without coding to make it as such.

Link to comment
Share on other sites

Solved! ;)

 

Created the two column and left the original column the same and just update the new column every time. Every1 in my team loves the idea so am sticking with that.

 

Thanks for your help monkeytooth. your tha man!

 

Thank alot guyz

Link to comment
Share on other sites

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.