Samurai Legend Posted April 4, 2016 Share Posted April 4, 2016 For some reason, when my cron gives me this error. Which I do not know why it is not working. QUERY ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `strikes` = `strikes` + IF(`job` > 0, 1, 0), `mailban` = `mai' at line 5 Query was UPDATE `users` SET `daysinclan` = `daysinclan` + IF(`clan` > 0, 1, 0), `daysold` = `daysold` + 1, `course_daily_clicks` = 0, `wof_spins` = 0, `work` = 0, `claimedloginbonus` = 0, `boxes` = IF(`donatordays` > 0, `boxes` + 25, `boxes` + 10) WHERE `boxes` < 25, `strikes` = `strikes` + IF(`job` > 0, 1, 0), `mailban` = `mailban` - IF(`mailban` > 0, 1, 0), `donatordays` = `donatordays` - IF(`donatordays` > 0, 1, 0), `cdays` = `cdays` - IF(`course` > 0, 1, 0), `steps` = IF(`donatordays` > 0, `steps` + 100, `steps` + 50) WHERE `steps` < 250, `married_days` = IF(`married`, `married_days` + 1, 0), `bankmoney` = `bankmoney` + IF(`bankmoney` > 0, `bankmoney` / 50, 0), `cybermoney` = `cybermoney` + IF(`cybermoney` > 0, `cybermoney` / 100 * 7, 0) $user_update_query = "UPDATE `users` SET `daysinclan` = `daysinclan` + IF(`clan` > 0, 1, 0), `daysold` = `daysold` + 1, `course_daily_clicks` = 0, `wof_spins` = 0, `work` = 0, `claimedloginbonus` = 0, `boxes` = IF(`donatordays` > 0, `boxes` + 25, `boxes` + 10) WHERE `boxes` < 25, `strikes` = `strikes` + IF(`job` > 0, 1, 0), `mailban` = `mailban` - IF(`mailban` > 0, 1, 0), `donatordays` = `donatordays` - IF(`donatordays` > 0, 1, 0), `cdays` = `cdays` - IF(`course` > 0, 1, 0), `steps` = IF(`donatordays` > 0, `steps` + 100, `steps` + 50) WHERE `steps` < 250, `married_days` = IF(`married`, `married_days` + 1, 0), `bankmoney` = `bankmoney` + IF(`bankmoney` > 0, `bankmoney` / 50, 0), `cybermoney` = `cybermoney` + IF(`cybermoney` > 0, `cybermoney` / 100 * 7, 0)"; $db->query($user_update_query); Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 4, 2016 Share Posted April 4, 2016 Why don't you write it like you did for the boxes? Quote Link to comment Share on other sites More sharing options...
alexander7567 Posted April 4, 2016 Share Posted April 4, 2016 (edited) How come nobody here uses PDO? Does everyone realise that in just a few versions of PHP, MySQL functions are going to be removed from PHP all together? I have almost fully converted my game over. But anything new I make, I always use PDO. Edit: dug into it a little further and found out they are removing it in PHP 7. However I found out that it will still be available as an add-on. (https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7) Edited April 4, 2016 by alexander7567 Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted April 4, 2016 Share Posted April 4, 2016 Its because its MCCodes. MCCodes uses mysqli in their wrapper which will still work Quote Link to comment Share on other sites More sharing options...
G7470 Posted April 4, 2016 Share Posted April 4, 2016 Also, to follow up [uSER=69869]alexander7567[/uSER], the mysql_ extension will be removed - the mysqli_ extension will still work just fine in PHP 7. ~G7470 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted April 4, 2016 Share Posted April 4, 2016 Error exists because you've added a WHERE clause. Remove it (and put the "boxes" part of the query in a new query, or change it so it doesn't needed the WHERE) Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted April 4, 2016 Author Share Posted April 4, 2016 Thanks everyone, [uSER=53425]Magictallguy[/uSER] method has worked. :) 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.