SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2005
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question plz. see wats wrong with this script?

    PHP Code:
    <?php

    $var
    =$_POST['username'];
    $pass=md5($_POST['password']);
    $passwor=$pass;
    /* Connect to the MySQL database */
        
    $db_connection mysql_connect("localhost""yyyy""xxxx")
            or die(
    "Could not connect to DB");

        
    /* Select the MasteringPHP database */
        
    mysql_select_db ("student"$db_connection)
            or die(
    "Could not find DB");

        
    /* Store the query to be executed in a variable */






            
    $query1 "SELECT DISTINCT firstname,
                                       lastname
                     FROM teachers
                     WHERE username='
    $var' AND password='$pass';
         /* Send the query to MySQL for execution */
        
    $query_result = mysql_query ($query1$db_connection) or die(mysql_error());
    if(@mysql_num_rows(
    $query_result)==0)
    {
      print "
    please check your username and password";  //line 29
      include "
    tchrs_login.php";
    // exit();
     }
     //include "
    tchrs_choice.php";
     ?>
    i get the following error:

    Parse error: parse error in C:\Program Files\Apache Group\Apache2\htdocs\student\tchrs_authentication.php on line 29

    note that i have commented line 29

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    PHP Code:
    <?php 

    $var
    =$_POST['username']; 
    $pass=md5($_POST['password']); 
    $passwor=$pass
    /* Connect to the MySQL database */ 
        
    $db_connection mysql_connect("localhost""yyyy""xxxx"
            or die(
    "Could not connect to DB"); 

        
    /* Select the MasteringPHP database */ 
        
    mysql_select_db ("student"$db_connection
            or die(
    "Could not find DB"); 

        
    /* Store the query to be executed in a variable */ 






            
    $query1 "SELECT DISTINCT firstname, 
                                       lastname 
                     FROM teachers 
                     WHERE username='
    $var' AND password='$pass'"
         
    /* Send the query to MySQL for execution */ 
        
    $query_result mysql_query ($query1$db_connection) or die(mysql_error()); 
    if(@
    mysql_num_rows($query_result)==0

      print 
    "please check your username and password";  //line 29 
      
    include "tchrs_login.php"
    // exit(); 

    //include "tchrs_choice.php"; 
    ?>
    Look at the syntax highlighting!
    You missed a closing " on your query.

    SpikeZ
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •