11-24-2016, 12:43 AM
Okay....last time I think haha
Trying to get it to where it won't update the DB again if you already have the boolean set as 1.
$db->query("UPDATE users SET on_break = CASE WHEN on_break = 0 THEN 1, ELSE 0 END WHERE id = ?",array($user->data()->id));
This actually ends up doing nothing as far as setting the on_break flag or not in the DB. I've tried if/thens wrapped around the $_POST['break_out]' but those don't seem to actually be able to pull the results correctly and I'm not getting anywhere there either. I tried doing a $db->query("SELECT * FROM users WHERE on_break = 1") where it saved the query as a variable, and then did if statements using if (is_bool === true) but, that wasn't working either.
Full code can be found at http://pastebin.com/nY5L3pbd if it helps clarify anything.
Basically I just don't want people to be able to continue clicking a button that they've already clicked.
Trying to get it to where it won't update the DB again if you already have the boolean set as 1.
$db->query("UPDATE users SET on_break = CASE WHEN on_break = 0 THEN 1, ELSE 0 END WHERE id = ?",array($user->data()->id));
This actually ends up doing nothing as far as setting the on_break flag or not in the DB. I've tried if/thens wrapped around the $_POST['break_out]' but those don't seem to actually be able to pull the results correctly and I'm not getting anywhere there either. I tried doing a $db->query("SELECT * FROM users WHERE on_break = 1") where it saved the query as a variable, and then did if statements using if (is_bool === true) but, that wasn't working either.
Full code can be found at http://pastebin.com/nY5L3pbd if it helps clarify anything.
Basically I just don't want people to be able to continue clicking a button that they've already clicked.