devilsvein Posted January 16, 2013 Share Posted January 16, 2013 Hi, I'm using crons for the first time and have done a bit of research around the web.I'm using crons on a php file of mine at the momment. In my cron jobs I've added this line, as I want this onemin.php file to run on a daily basis. (sorry for name confusion) 0 0 * * * php /home4/******/public_html/crons/onemin.php the actual code on my onemin.php is as so... <?php require "corefolder/globe.php"; //db require "corefolder/gamecore.php"; //Updating days old mysqli_query($query, "UPDATE Persons SET daysold=daysold++"); ?> The issue im having is that it doesn't increment daysold as ive checked it after 24 hours and well its still 0. Secondly I wanted to see if anyone could explain the difference between using php and curl in the cron command and whether theres a suitable alternative. Lastly how can i tell what time this cron is running at due to the fact theres many different timezones around the planet and my webhost is in the states. Quote Link to comment https://forums.phpfreaks.com/topic/273236-some-guidance-on-crons/ Share on other sites More sharing options...
Jessica Posted January 16, 2013 Share Posted January 16, 2013 Have you tried running the query in phpmyadmin? I'm pretty sure that query would fail. Quote Link to comment https://forums.phpfreaks.com/topic/273236-some-guidance-on-crons/#findComment-1406098 Share on other sites More sharing options...
devilsvein Posted January 16, 2013 Author Share Posted January 16, 2013 (edited) First mistake i found should been $mysqli and not $query. PHPMYADMIN does show a syntax error. Get confused on that sometimes.... Thanks Jessica, ill see how it goes now isit because ++ isnt recognised? i tried UPDATE Persons SET daysold=daysold+1 and this worked Edited January 16, 2013 by devilsvein Quote Link to comment https://forums.phpfreaks.com/topic/273236-some-guidance-on-crons/#findComment-1406100 Share on other sites More sharing options...
Jessica Posted January 16, 2013 Share Posted January 16, 2013 I missed that too. I still think your query is wrong. I don't think you can ++ a column. I've always done column=column+1 Quote Link to comment https://forums.phpfreaks.com/topic/273236-some-guidance-on-crons/#findComment-1406101 Share on other sites More sharing options...
Jessica Posted January 16, 2013 Share Posted January 16, 2013 Edit: I misread your last post. Either way. Quote Link to comment https://forums.phpfreaks.com/topic/273236-some-guidance-on-crons/#findComment-1406102 Share on other sites More sharing options...
devilsvein Posted January 16, 2013 Author Share Posted January 16, 2013 Lol I appreciate your quick help and support! Thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/273236-some-guidance-on-crons/#findComment-1406103 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.