unexpected $end error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atullalit91
    New Member
    • May 2010
    • 3

    #1

    unexpected $end error

    this error states mismatching but i didn't get the success in tracking that error, plss solve it out.... i am new to php therefore guide me the best practise that should help me.....
    Code:
    <?php
    
    $host="localhost"; // Host name
    $username=""; // Mysql username
    $password=""; // Mysql password
    $db_name="test"; // Database name
    $tbl_name="test_mysql"; // Table name
    
    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // Retrieve data from database
    $sql="SELECT * FROM $tbl_name";
    $result=mysql_query($sql);
    
    // Start looping rows in mysql database.
    while($rows=mysql_fetch_array($result)){
    ?>
    <table width="400" border="1" cellspacing="0" cellpadding="3">
    <tr>
    <td width="10%"><? echo $rows['id']; ?></td>
    <td width="30%"><? echo $rows['name']; ?></td>
    <td width="30%"><? echo $rows['lastname']; ?></td>
    <td width="30%"><? echo $rows['email']; ?></td>
    </tr>
    </table>
    
    <?
    // close while loop
    }
    
    // close connection
    mysql_close();
    ?>
    Last edited by atullalit91; May 9 '10, 02:24 PM. Reason: i hv changed the code, plss in replying kindly highlight the changed line code.. m new to php so it wl help me
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    On line 19, is that opening curly brace supposed to be there?

    Comment

    • atullalit91
      New Member
      • May 2010
      • 3

      #3
      Originally posted by Markus
      On line 19, is that opening curly brace supposed to be there?
      kindly plss track the wrong code and do the require changes in it.... m new to php so slightly confused to trying anything...

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        I have tracked the error, and also told you where it is. Now you do the work.

        Edit. Please do not modify the original code, without telling us that you have done so. The code, as it is now, should not be producing the error.

        Comment

        • atullalit91
          New Member
          • May 2010
          • 3

          #5
          Originally posted by Markus
          I have tracked the error, and also told you where it is. Now you do the work.

          Edit. Please do not modify the original code, without telling us that you have done so. The code, as it is now, should not be producing the error.
          actually the code that i was earliar posted was repeating while statement once more time which is not required.... could you plss check out this currently posted code.... m at the beginning phase so i need ur help as a senior....

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            I have no idea what your problem is now, so do enlighten me.

            Comment

            Working...