#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    19
    Rep Power
    0

    Parsing error on the last line


    hi guyz i'm getting a parsing error on the ?>
    Any advice and assistance most welcome.

    here's some of my code:

    PHP Code:
    /*The following code lists the the names and student no.s of the students in the "student" table*/
     
    echo "<table border='1' width='600' cellspacing='0' cellpadding='0'>";
     
    $query "SELECT sno, fname, sname FROM student";
     
    $result mysql_query($query);
     while (
    $row mysql_fetch_array($result)) {
      echo 
    "<tr>";
      echo 
    "<td width='10%'>";
      echo 
    $row["sno"];
      echo 
    "</td>";
      echo 
    "<td width='30%'>";
      echo 
    $row["fname"];
      echo 
    "</td>";
      echo 
    "<td width='30%'>";
      echo 
    $row["sname"];
      echo 
    "</td>";
      echo 
    "<td width='15%'>";
      
    /*We are passing a variable called code ($code) via the URL. This variable will be used to know which record we   want to delete*/
      
    echo "<a href='delete_student.php?code=".$row["sno"]."'>Delete</a>";
      echo 
    "</td>";
      echo 
    "<td width='15%'>";
      echo 
    "<a href='edit_student.php?code=".$row["sno"]."'>Edit</a>";
      echo 
    "</td>";
      echo 
    "</tr>"; }
     echo 
    "</table>";
     
    ?> 
  2. #2
  3. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,574
    Rep Power
    2342
    Missing another } perhaps?
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,884
    Rep Power
    6355
    This is exactly why you should put your curly braces on their own lines and indent their contents so that missing braces stand out like sore thumbs. Follow the Zend Coding Standards

    -Dan
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2004
    Posts
    855
    Rep Power
    1394
    Or simply use a text-editor / IDE which has support for matching opening/closing braces.
    PHP Code:
    <?php
    abstract class Ignorance extends Stupidity implements Unavoidable 
         public static 
    $humiliation

         private function 
    __construct(){
            
    parent::__destruct();
         }; 

    ?>
  8. #5
  9. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,884
    Rep Power
    6355
    Using an IDE with bracket matching is very handy until your control statements start spanning more than one screen's worth of lines, then it doesn't matter. I LOVED the old Zend5 bracket matching (the match would show up in a pop-up regardless of where it was in the code) but they got rid of it.

    Still though, format your code properly and you'll probably see it. Hint: It's not in the code you provided.

    -Dan
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2004
    Posts
    855
    Rep Power
    1394
    Originally Posted by ManiacDan
    Using an IDE with bracket matching is very handy until your control statements start spanning more than one screen's worth of lines, then it doesn't matter. -Dan
    Well that's the reason why editors/IDE's with bracket matching capability usually also come with code folding

    But yeah, no IDE/editor is going to save anyone without at least some coding discipline.

    Comments on this post

    • ManiacDan agrees : I HATE code folding
    PHP Code:
    <?php
    abstract class Ignorance extends Stupidity implements Unavoidable 
         public static 
    $humiliation

         private function 
    __construct(){
            
    parent::__destruct();
         }; 

    ?>
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    19
    Rep Power
    0
    Originally Posted by ptr2void
    Missing another } perhaps?
    Thanks dude u were rite. Sorry for replying so late.

IMN logo majestic logo threadwatch logo seochat tools logo