SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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...


    aDog

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That would be the missing quote on this line:
    $checksqlstatement = mysql_query("SELECT * FROM Teachers");
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I fixed that and also, I forgot to use $ when assigning $id. It should be:

    $id=$checkotherstuff["ID"];

    and now, it works.


    THANX

    aDog


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •