So, I want to pair users only in PHP:
First get one available user id // not random right now
mysql_query('SELECT id FROM users WHERE state="0" LIMIT 1'); //state 0 = user avaliable, 1 = talking/playing with someone
$ available_id = stuffs to get id from request
And then update:
$result = mysql_query('UPDATE INTO users SET state="1" WHERE (id=$available_id OR id=$my_id) AND state="0"');
if $result == false, then this means that no row has been updated. So, back to the first step,
if $result == trueso what? this may mean that my line is updated or available to the user, or both. I am confused how to handle this.
source
share