Okay, I'm having a bit of an issue with looping through sockets to see which one is connected and check certain information about each socket.
Here's what I am trying to do:
- Socket connects, and its id is stored in variable $i and also in the sql db
- User attempts to load a room, and other info is saved to variables
($currentroom[$i] , $currentx[$i], and so on)
- Server loops through all users in sql table and sees what socket id the user is assigned to and see which ones are in the same room id
Heres what I have so far:
Here's what I am trying to do:
- Socket connects, and its id is stored in variable $i and also in the sql db
- User attempts to load a room, and other info is saved to variables
($currentroom[$i] , $currentx[$i], and so on)
- Server loops through all users in sql table and sees what socket id the user is assigned to and see which ones are in the same room id
Heres what I have so far:
PHP:
/*while($users = mysql_fetch_array($getroomusers))
{
$tempsocket = getSocketFromUsername($users['name']);
if($currentroom[$tempsocket] == $roomid)
{
$usertemp .= $username[$tempsocket] ." \n". $figure[$tempsocket] ." ". $currentx[$tempsocket] ." ". $currenty[$tempsocket] ." ". $currentz[$tempsocket] ." \n". $customdata[$tempsocket] ."\n";
}
}
*/