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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -