Jump to content

Recommended Posts

okay so im making a game, and because my current host doesnt allow Cron jobs... ive had to create my own file which when called it will update my database.

 

what im wanting is for a code which will make it so:

 

$player-> will + 5 but not go higher than $player->maxnerve.

 

the reason i cant give maxnerve a value is because it can change depending on each player.

Link to comment
https://forums.phpfreaks.com/topic/135416-query-help/
Share on other sites

i mean awake and maxawake instead of nerve... but it doesnt matter too much.

 

would this work?

 

if (awake +5 >= maxawake){

$query = $db->execute("update `players` set awake = maxawake WHERE `id`=?", array($player->id));

}

 

if (awake +5 < maxawake){

$query = $db->execute("update `players` set awake + 5 WHERE `id`=?",

array($player->id));

}

 

EDIT: it didnt work.... now going to try your way.

Link to comment
https://forums.phpfreaks.com/topic/135416-query-help/#findComment-705369
Share on other sites

Can you please:

 

1) echo out $query.

2) add or die(mysql_error()) to the end of your queries.

3) add this to the top of your script:

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

Not sure but I think you also need to do:

 

if((awake+5) >= maxawake) {

Link to comment
https://forums.phpfreaks.com/topic/135416-query-help/#findComment-705415
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.