TheStalker Posted February 10, 2008 Share Posted February 10, 2008 Hi i am pretty new to both php and sql so be gental lol I am running WAMP5 server on local host. I am trying to add a vaule to one of my tables on a daily basis. I have a table with CustomerID, Surname, Newspaper and AmountOwing. Every day i want to add the price of a newspaper to the amount owing. Im guessing it would have some thing to do with the datestamp ? like this i know this is prob not the right syntax but if some one could point me in the right direction that would be great!! OR if there is a better way to do this any ideas would be great as well!! <?php $d_var=getdate(mktime()); if $d_var[wday]= 0,1,2,3,4,5,6 sql=UPDATE AmountOwing VALUES+ 0.35 WHERE Newspaper='sun' esle if sql=UPDATE AmountOwing VALUES+ 0.65 WHERE Newspaper='The Times' else if etc etc Also another of my big problems is going to be getting the code to only execute once a day. So each time the page is refreshed it wont keep doing the calculation if its already been done on that day. Many thanks Link to comment https://forums.phpfreaks.com/topic/90354-adding-values-daily-phpsql-pls/ Share on other sites More sharing options...
trq Posted February 10, 2008 Share Posted February 10, 2008 If you want to run a script periodically you would need to use a cronjob on a Linux server. I believe windows has some task schedual that offers similar functionality. Link to comment https://forums.phpfreaks.com/topic/90354-adding-values-daily-phpsql-pls/#findComment-463267 Share on other sites More sharing options...
TheStalker Posted February 10, 2008 Author Share Posted February 10, 2008 ok what if i just had a button that did the same thing and didnt worry about having it update daily? Link to comment https://forums.phpfreaks.com/topic/90354-adding-values-daily-phpsql-pls/#findComment-463373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.