kamal213 Posted June 13, 2011 Share Posted June 13, 2011 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. Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 13, 2011 Share Posted June 13, 2011 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. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted June 13, 2011 Share Posted June 13, 2011 Could you just store the db value before you update in a session then display the session value? Quote Link to comment Share on other sites More sharing options...
kamal213 Posted June 13, 2011 Author Share Posted June 13, 2011 Thanks runnerjp, The thing with sessions is i would like to know what the original value was in 2day/2weeks/2 years time, Do you think this can be possible with sessions? Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 13, 2011 Share Posted June 13, 2011 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.. Quote Link to comment Share on other sites More sharing options...
kamal213 Posted June 13, 2011 Author Share Posted June 13, 2011 Thanks monkeytooth, I have created the new column. If for example original value = 1 and New value = 2, The next time I update the new column would the original value stay the same? Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 13, 2011 Share Posted June 13, 2011 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. Quote Link to comment Share on other sites More sharing options...
kamal213 Posted June 13, 2011 Author Share Posted June 13, 2011 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 Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted June 13, 2011 Share Posted June 13, 2011 not a problem, your welcome that's what I hang around here for :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.