Can someone tell what I'm doing wrong? I get an error at the session_start and 
it doesn't 
register the user name in a cookie.

Thanks,

Jer



session_start();

if ($userid && $password)
{
  // if the user has just tried to log in

mysql_connect('localhost', 'xx', 'xx');
mysql_select_db('xx');

$query = "SELECT * FROM users
WHERE username = '$userid' AND password = '$password'";
$result = mysql_query($query) or die(mysql_error());
$rows = mysql_num_rows($result);

  if (0<>$rows)
  {
    // if they are in the database register the user id
  
        while ($name = mysql_fetch_array($result))
        {
        $valid_user = $name["username"];
    session_register("$valid_user");
   
        print '<span class="header">Welcome back, 
'.$name["username"].'!</span>';
        }
        
  }
  else
  {
   print '<span class="header">You could not be logged in. Please try again or 
register.</
span>';
  }
}






The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php_mysql/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to