T_logical_AND

Discussion in 'PHP' started by gilk, Aug 7, 2007.

  1. #1
    I get this error for the following code, yet I have not used any AND in the code.
    HAve checked the curlies and parentheses for matching, and searched for answers to similar problems without success.
    Any help would be appreciated. Thanks in anticipation.

      // add a pass/fail  and number of wrong answers to the student answer submission record
    
      echo "....adding PASS or FAIL to your submission record<br>";
    
                     if ($wrong_answers !=0) {     // if one or more wrong answers
    
                        $pf = "f" ;                // set variable to f for fail
    
            $add_pass_fail = " UPDATE studentanswers SET passfail = '$pf', num_wrong = $wrong_answers WHERE  id = '$last_id'  ";
    // do query and error routine                
    
     mysql_query($add_pass_fail, $conn) or die(mysql_error("Cant add PASS/FAIL status to student submission"));  
    
       }
    PHP:
    I have found the error...it was with parentheses about 300 lines past where php interpreter said it was!!!
    Thanks
     
    gilk, Aug 7, 2007 IP
  2. xdimension

    xdimension Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    in which line exactly the error occured? that code seems having no problem.
     
    xdimension, Aug 7, 2007 IP
  3. killerj

    killerj Active Member

    Messages:
    765
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    95
    #3
    Change this
     $add_pass_fail = " UPDATE studentanswers SET passfail = '$pf', num_wrong = $wrong_answers WHERE  id = '$last_id'  ";
    PHP:
    To this
     $add_pass_fail = " UPDATE studentanswers SET passfail = '$pf', num_wrong = '$wrong_answers' WHERE  id = '$last_id'  ";
    PHP:
     
    killerj, Aug 7, 2007 IP
  4. xdimension

    xdimension Peon

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yeah... good point, assumed if $wrong_answers isn't numeric type var...
     
    xdimension, Aug 7, 2007 IP
  5. gilk

    gilk Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I have found the error...it was with parentheses about 300 lines past where php interpreter said it was!!!
    Thanks
     
    gilk, Aug 8, 2007 IP