-
Hi, I'm creating an include so that if the password and username do not match on in the database, they are sent back to login.php If one matches int he database, the variable, $id, stores their username and password's id to be used later. Here's the code for the include page:
Code:
<?php
if($UserName && $PassWord){
$checksqlstatement = mysql_query("SELECT * FROM Teachers);
while($checkotherstuff = mysql_fetch_array($checksqlstatement)){
if(($UserName==$checkotherstuff["UserName"]) && ($PassWord==$checkotherstuff["PassWord"])){
$id=checkotherstuff["id"];
$rightfullyhere="correct";
}
}
}
if(!$rightfullyhere || $rightfullyhere!="correct"){
header("Location: login.php");
}
?>
and here is the error I get:
Code:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in pass1.inc on line 5
I don't know what's wrong with the code, though... :confused:
aDog :cool:
-
That would be the missing quote on this line:
$checksqlstatement = mysql_query("SELECT * FROM Teachers");
-
Ok, I fixed that and also, I forgot to use $ when assigning $id. It should be:
$id=$checkotherstuff["ID"];
and now, it works.
THANX :D
aDog :cool: