I'm trying to set a cookie on a user who logs in with a username and password, but I keep getting a parse error at the setcookie function. Here's my code, could someone tell me what I'm doing wrong?
<?php
// Connect to database
$expire = time() + 3600;
$path = "/";
$domain = ".mydomain.net";
$memb = 12345;
$query = "SELECT USERNAME, PASSWORD FROM MEMBERS";
$query .= " WHERE USERNAME = '$USER' AND";
$query .= " PASSWORD = '$PWORD';
$user_result = mysql_query($query);
$user_num = mysql_num_rows($user_result);
if ($user_num == 1) {
#This is where I keep getting the parse error
setcookie ("id", $memb, $expire, $path, $domain, 0);
}
?>
<head>
<title>User Authentication</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<?php
echo "Congratulations, you have logged in as $USERNAME";
echo "<p> You're cookie value is $memb ";
?>
</body>