Jump to content

Query Help.


seany123

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.