php - Adding session in while (mysql) -
if(isset($_session['username'])) { $con = mysql_connect('localhost','root',''); mysql_select_db('chatbox',$con); $result = mysql_query("select id users"); mysql_query("update users set `online` = 0 `username` = ".$username.""); }
can make username session (that logged in) equal to
mysql_query("update users set `online` = 0 `username` = "to_put_it_here");
simple , cute trick
$username = $_session['username']; if(isset($username)) { $con = mysql_connect('localhost','root',''); mysql_select_db('chatbox',$con); $result = mysql_query("select id users"); mysql_query("update users set `online` = 0 `username` = '$username' "); }
Comments
Post a Comment