Ads Posted May 19, 2010 Share Posted May 19, 2010 This is Probabaly the most obvious thing, but i seem to overlook it I am trying to make a online users list, That i have made na ti works well, within the user list i am trying to add a section that display the current page the user is on. On each page I am adding: include "globals.php"; $page = "Home"; and then within the globals page I have: global $page; $db=mysql_query("UPDATE users SET location = '$page' WHERE userid=$ir[userid]"); But it Doesn't Update the Database at all. The Globals.php is included in every single page. Any Help would be Great Quote Link to comment Share on other sites More sharing options...
ale8oneboy Posted May 19, 2010 Share Posted May 19, 2010 This is Probabaly the most obvious thing, but i seem to overlook it I am trying to make a online users list, That i have made na ti works well, within the user list i am trying to add a section that display the current page the user is on. On each page I am adding: include "globals.php"; $page = "Home"; and then within the globals page I have: global $page; $db=mysql_query("UPDATE users SET location = '$page' WHERE userid=$ir[userid]"); But it Doesn't Update the Database at all. The Globals.php is included in every single page. Any Help would be Great Try changing your query to the following: $db=mysql_query("UPDATE users SET location = '$page' WHERE userid=".$ir['userid']); Quote Link to comment Share on other sites More sharing options...
Wolphie Posted May 19, 2010 Share Posted May 19, 2010 It should be noted that when using inline variables which contain arrays you must use curly braces around it. E.g. echo "Hi my name is {$user['name']}"; Quote Link to comment Share on other sites More sharing options...
Ads Posted May 19, 2010 Author Share Posted May 19, 2010 Sadly that did not work, I think the Problem Lies with the global $page; As if i set page to equal anything right above the sql statment it works fine. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.