Hi, I want to add "Welcome Back $user" to my index.php page. It's not working I get the following error.
I figure this is because SESSION_START needs to be on line one. But it still isn't working.Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rodgameo/public_html/projects/dmv/index.php:1) in /home/rodgameo/public_html/projects/dmv/index.php on line 35
This is the very top of my page.
and this is in the script in the spot where I want to check.PHP Code:
mysql_connect('localhost', 'user', 'pass') or die(mysql_error());
mysql_select_db('database') or die(mysql_error());
How can I get it to check the session and pull the username from the database both?PHP Code:
$who = mysql_query("SELECT username FROM users WHERE id='".$_SESSION['user_id']."'");
$row = mysql_fetch_array($who);
echo "<b>Welcome Back ".$row['username']."!</b>";