Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. need help with php parse error

need help with php parse error

Scheduled Pinned Locked Moved Web Development
helpphp
11 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Izu Great

    i am working on a project and on a page i get this error. Parse error: parse error in C:\wamp\www\RMS\comresult.php on line 143 line 143 is the last line of my code. Please i need help.

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Well I'm afraid we cannot guess what is on line 143; or any other line. Please show the code, especially the line where the error occurs.

    I 1 Reply Last reply
    0
    • L Lost User

      Well I'm afraid we cannot guess what is on line 143; or any other line. Please show the code, especially the line where the error occurs.

      I Offline
      I Offline
      Izu Great
      wrote on last edited by
      #3

      Line 143 is the last line "". This is my code.

      <?php
      include("conn.php");
      session_start();
      ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Welcome :: Result Portal</title>
      <link href="style.css" rel="stylesheet" type="text/css" />
      <style type="text/css">
      body {
      background-color: #FFF;
      }
      </style>
      <!--[if IE]>
      <script src="ie/dist/html5shiv.js"></script>
      <script src="ie/dist/html5shiv-printshiv.js"></script>
      <![endif-->
      <script type="text/javascript">
      function bk(){
      location.assign(document.referrer);
      }
      var state = true;

      function getstate(){
      return state;
      }
      </script>
      </head>

      <body onload="print()">
      <?php
      if(isset($_GET['lev'],$_GET['sem'],$_GET['prog'],$_GET['sess'])){
      $level = $mysqli->real_escape_string(trim($_GET['lev']));
      $sem = $mysqli->real_escape_string(trim($_GET['sem']));
      $prog = $mysqli->real_escape_string(trim($_GET['prog']));
      $sess = $mysqli->real_escape_string(trim($_GET['sess']));

      $sql = "SELECT \* FROM course\_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
      if($result = $mysqli->query($sql)){
          if($result->num\_rows > 0){
      
          $sel = "SELECT DISTINCT regno FROM st\_result\_data WHERE level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$prog."'";
      
          if($res = $mysqli->query($sel)){
              if($res->num\_rows > 0){
      
                  //$sel2 = "SELECT \* FROM st\_result\_data WHERE regno LIKE '".$row\['regno'\]."' AND level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$row\['programme'\]."'";
              //if($res2 = $mysqli->query($sel2)){
                  //if($res2->num\_rows > 0){
                  ?>
      
      L 1 Reply Last reply
      0
      • I Izu Great

        Line 143 is the last line "". This is my code.

        <?php
        include("conn.php");
        session_start();
        ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Welcome :: Result Portal</title>
        <link href="style.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
        body {
        background-color: #FFF;
        }
        </style>
        <!--[if IE]>
        <script src="ie/dist/html5shiv.js"></script>
        <script src="ie/dist/html5shiv-printshiv.js"></script>
        <![endif-->
        <script type="text/javascript">
        function bk(){
        location.assign(document.referrer);
        }
        var state = true;

        function getstate(){
        return state;
        }
        </script>
        </head>

        <body onload="print()">
        <?php
        if(isset($_GET['lev'],$_GET['sem'],$_GET['prog'],$_GET['sess'])){
        $level = $mysqli->real_escape_string(trim($_GET['lev']));
        $sem = $mysqli->real_escape_string(trim($_GET['sem']));
        $prog = $mysqli->real_escape_string(trim($_GET['prog']));
        $sess = $mysqli->real_escape_string(trim($_GET['sess']));

        $sql = "SELECT \* FROM course\_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
        if($result = $mysqli->query($sql)){
            if($result->num\_rows > 0){
        
            $sel = "SELECT DISTINCT regno FROM st\_result\_data WHERE level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$prog."'";
        
            if($res = $mysqli->query($sel)){
                if($res->num\_rows > 0){
        
                    //$sel2 = "SELECT \* FROM st\_result\_data WHERE regno LIKE '".$row\['regno'\]."' AND level LIKE '".$level."' AND semester LIKE '".$sem."' AND programme LIKE '".$row\['programme'\]."'";
                //if($res2 = $mysqli->query($sel2)){
                    //if($res2->num\_rows > 0){
                    ?>
        
        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        At a guess you have a mismatched brace or HTML tag.

        I 1 Reply Last reply
        0
        • L Lost User

          At a guess you have a mismatched brace or HTML tag.

          I Offline
          I Offline
          Izu Great
          wrote on last edited by
          #5

          The braces are Matched correctly.

          L 1 Reply Last reply
          0
          • I Izu Great

            The braces are Matched correctly.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            I can only suggest that you go through the code and remove sections one at a time until the error disappears. You will then be able to see which section is the cause and correct it.

            I 2 Replies Last reply
            0
            • L Lost User

              I can only suggest that you go through the code and remove sections one at a time until the error disappears. You will then be able to see which section is the cause and correct it.

              I Offline
              I Offline
              Izu Great
              wrote on last edited by
              #7

              Ok thanks I found the problem.

              1 Reply Last reply
              0
              • L Lost User

                I can only suggest that you go through the code and remove sections one at a time until the error disappears. You will then be able to see which section is the cause and correct it.

                I Offline
                I Offline
                Izu Great
                wrote on last edited by
                #8

                this is the problem.

                <?php
                $sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
                if($result = $mysqli->query($sql)){
                if($result->num_rows > 0){
                while($rw = $result->fetch_array()){
                ?>

                     <?
                 }}}
                 ?>
                

                whenver i try to loop through $result->fetch_array() it returns the Parse Error.

                L G I 3 Replies Last reply
                0
                • I Izu Great

                  this is the problem.

                  <?php
                  $sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
                  if($result = $mysqli->query($sql)){
                  if($result->num_rows > 0){
                  while($rw = $result->fetch_array()){
                  ?>

                       <?
                   }}}
                   ?>
                  

                  whenver i try to loop through $result->fetch_array() it returns the Parse Error.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  I am not sure about the extra ?> and <?, perhaps it should be:

                  query($sql)){
                  if($result->num_rows > 0){
                  while($rw = $result->fetch_array()){
                  }
                  }
                  }
                  ?>

                  See http://www.w3schools.com/php/php_looping.asp[^].

                  1 Reply Last reply
                  0
                  • I Izu Great

                    this is the problem.

                    <?php
                    $sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
                    if($result = $mysqli->query($sql)){
                    if($result->num_rows > 0){
                    while($rw = $result->fetch_array()){
                    ?>

                         <?
                     }}}
                     ?>
                    

                    whenver i try to loop through $result->fetch_array() it returns the Parse Error.

                    G Offline
                    G Offline
                    Graham Breach
                    wrote on last edited by
                    #10

                    You have used a short PHP opening tag "<?" inside the loop instead of the full tag "<?php" - if short_open_tag is disabled in your php.ini, then this will cause a parse error.

                    1 Reply Last reply
                    0
                    • I Izu Great

                      this is the problem.

                      <?php
                      $sql = "SELECT * FROM course_tb WHERE level LIKE '".$level."' AND semester LIKE '".$sem."'";
                      if($result = $mysqli->query($sql)){
                      if($result->num_rows > 0){
                      while($rw = $result->fetch_array()){
                      ?>

                           <?
                       }}}
                       ?>
                      

                      whenver i try to loop through $result->fetch_array() it returns the Parse Error.

                      I Offline
                      I Offline
                      Izu Great
                      wrote on last edited by
                      #11

                      Thank your suggestions worked out.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups