I’m a noob when it comes to mysql and php, and just want to ask if I do this correct:
-
I want to SELECT from a table where “lastTurn” is more then 12h. Is this the correct way to do it. I’m most concernt with the 12h time stamp
$queryQuit = mysql_query("SELECT match_id, lastTurn FROM active_matches WHERE matchStatus=0 AND noticeSent < 2 AND lastTurn < NOW() - INTERVAL 12 HOUR"); -
I use Asihttprequest to send data to the server. If I send an int, do I need to convert it before it goes into the database?
//score is an int $score = mysql_real_escape_string($_POST['score']); //Update a table where the field is an int "UPDATE hiscore SET score=score + '$score' WHERE username='$username'"
Thanks in advance
This looks correct
You need to cast to int if you want to make sure you are saving an integer
Code example:
or