PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Sorry im a newbie when it comes to php and I keep coming up with this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/sensipet/www/www/login.php:46) in /home/sensipet/www/www/header.php on line 3
main reason why, is that I want to store some informatio from my database into a session variable but it wouldnt show up so I tried to echo it to make sure that I was doing it correctly and the variable appeared but so did that stupid error.
$query3 = "SELECT * FROM $table WHERE username='$Name2'";
$result3 = mysql_query($query3);
$row3 = mysql_fetch_array($result3, MYSQL_ASSOC);
$id = $row3['ID'];
$_SESSION['id'] = $id;
$user = $Name2;
$_SESSION['user'] = $user;
$_SESSION['sc'] = $row3['sc'];
echo $row3['sc'];
So im not sure if im doing it wrong or im just being slow .
Thanks
Howey
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().
Also:
php.net/session_register wrote:Caution
If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.