By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,330 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

unexpected $end error

P: 3
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.....
Expand|Select|Wrap|Line Numbers
  1. <?php
  3. $host="localhost"; // Host name
  4. $username=""; // Mysql username
  5. $password=""; // Mysql password
  6. $db_name="test"; // Database name
  7. $tbl_name="test_mysql"; // Table name
  9. // Connect to server and select database.
  10. mysql_connect("$host", "$username", "$password")or die("cannot connect");
  11. mysql_select_db("$db_name")or die("cannot select DB");
  13. // Retrieve data from database
  14. $sql="SELECT * FROM $tbl_name";
  15. $result=mysql_query($sql);
  17. // Start looping rows in mysql database.
  18. while($rows=mysql_fetch_array($result)){
  19. ?>
  20. <table width="400" border="1" cellspacing="0" cellpadding="3">
  21. <tr>
  22. <td width="10%"><? echo $rows['id']; ?></td>
  23. <td width="30%"><? echo $rows['name']; ?></td>
  24. <td width="30%"><? echo $rows['lastname']; ?></td>
  25. <td width="30%"><? echo $rows['email']; ?></td>
  26. </tr>
  27. </table>
  29. <?
  30. // close while loop
  31. }
  33. // close connection
  34. mysql_close();
  35. ?>
May 9 '10 #1
Share this Question
Share on Google+
5 Replies

Expert 5K+
P: 6,050
On line 19, is that opening curly brace supposed to be there?
May 9 '10 #2

P: 3
kindly plss track the wrong code and do the require changes in it.... m new to php so slightly confused to trying anything...
May 9 '10 #3

Expert 5K+
P: 6,050
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.
May 9 '10 #4

P: 3
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....
May 9 '10 #5

Expert 5K+
P: 6,050
I have no idea what your problem is now, so do enlighten me.
May 9 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.