You can't print any output before you start the session AFAIK. Daevid Vincent http://daevid.com
> -----Original Message----- > From: obsidianchrysalis [mailto:[EMAIL PROTECTED] > Sent: Tuesday, December 09, 2003 3:51 PM > To: [EMAIL PROTECTED] > Subject: [PHP] problems with starting session > > this code snippet is used to autheticate a user's id. > however, it generates > errors pertaining to the script not being able to send > headers with the > session data. > > // function authenticate() > // { > // import variables to be read from form > import_request_variables("p", "s_"); > > // set variables to connect to database > $db_host = "localhost"; > $db_user = "login_1"; > $db_pass = "addUser"; > $db_name = "jamison_id"; > > // connect to database > $connection = mysql_connect($db_host, $db_user, > $db_pass) or > die ("Unable to connect!"); > mysql_select_db($db_name); > $query = "SELECT id_num from login WHERE user = > '$s_user_id' > AND passwd = '$s_passwd'"; > $result = mysql_query($query, $connection) or > die ("Error in > query: '$query' ." . mysql_error()); > > // if row exists -> user/pass combination is correct > if (mysql_num_rows($result) == 1) > { > $valid = 1; > } > else > { > print($s_user_id); > print($s_passwd); > } > // } > // $valid = authenticate($s_user_id, $s_passwd); > print($valid); > if ($valid == 1) > { > > // initiate a session > session_start(); > > // register some session variables > // session_register("SESSION"); > > // including the username > // session_register("SESSION_UNAME"); > // $SESSION_UNAME = $f_user; > } > ?> > > any help would be appreciated. > > chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php