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

i written this code and i have error this code to retrieve my data from

P: 5
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>participator profile</title>
  5. <link rel="stylesheet" type="text/css" href="style.css">
  6. <link href="Stylle.css" rel="stylesheet" type="text/css" />
  7. </head>
  8. <body>
  9.  <div id ="logo">
  10. <!----- insert logo below ------------------------------------------>
  11. <img src="img/sss.jpg"  height="123" width="100%" border="0" alt="">
  12. <!------------------------------------------------------------------>
  13. </div>
  14. <div>  </div>
  15. <div>  </div>
  16. <div>  </div>
  17. <div>  </div>
  18. <div>  </div>
  19.  <div id = "nav">
  20. <!----- menu, insert links below ------------------------------------------>
  21. <div id="menu4">
  22. <ul id="menulist1">
  23. <li><a href="home.html">home</a></li>
  24. <li><a href=" ">upload research </a></li>
  25. <li><a href=" ">view symposium schedule</a></li>
  26. <li><a href=" ">log out</a></li>
  27. </ul>
  28. </div>
  29. <!-------------------------------------------------------------------------->
  30. </div>
  31. <div id = "container">
  32. <div id="content">
  33. <td width="100%">
  34. <div class="P">
  35. <p> 
  36. <font size="5" color="#1c436c">&nbsp;&nbsp;&nbsp;&nbsp; Schedule for Presentions </font>
  37. </div>
  38. </p>
  39. </br>
  40. <div class="Sc">
  41. <table border="1" cellpadding="2" cellspacing="2" width="100%">
  42. <?php
  43.   $dbhost = "localhost";
  44.   $dbuser = "root";
  45.   $dbpass = "";
  46.   $dbname = "sss";
  47.   $conn = mysql_connect($dbhost, $dbuser, $dbpass)
  48.   or die ('Error connecting to mysql');
  49.  $result = mysql_query("SELECT * FROM V") 
  50. or die(mysql_error());  
  51. echo "<table border='1'>";
  52. echo "<tr> <th>Date</th> <th>Time</th><th>Research Title</th><th>Judge Name</th><th>Judge ID</th><th>Room</th> </tr> ";
  53. // keeps getting the next row until there are no more to get
  54. while($row = mysql_fetch_array( $result ))
  55.  {
  56.     // Print out the contents of each row into a table
  57.     echo "<tr><td>"; 
  58.     echo $row['Data'];
  59.     echo "</td><td>"; 
  60.     echo $row['Time'];
  61.     echo "</td><td>"; 
  62.     echo $row['ResearchTitle'];
  63.     echo "</td><td>";
  64.     echo $row['JudgeName'];
  65.     echo "</td><td>";
  66.     echo $row['JudgeID'];
  67.     echo "</td><td>";
  68.     echo $row['Room'];
  69.     echo "</td></tr>";
  70. }
  71. echo "</table>";
  72. mysql_close($conn);
  73. ?>
  74. </body>
  75. </html>

i have error

Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in C:\xampp\htdocs\View.php on line 73

plz help me
Dec 7 '11 #1
Share this Question
Share on Google+
3 Replies


100+
P: 119
everything looks good!

you may need to add this for sure $db_name and need to select dbname which you have for your application.

Expand|Select|Wrap|Line Numbers
  1. $dbname = "sss";
  2.   $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
  3. $db_name = mysql_select_db('dbname', $conn);
  4.  $result = mysql_query("SELECT * FROM V") 
  5.  
  6.  
Dec 7 '11 #2

100+
P: 1,059
Your code is not showing the error you are talking about. check your file encoding. It can make the problem and

as phpmagesh suggested you will have to select database before you run select query
Dec 8 '11 #3

P: 78
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>participator profile</title>
  5. <link rel="stylesheet" type="text/css" href="style.css">
  6. <link href="Stylle.css" rel="stylesheet" type="text/css" />
  7. </head>
  8. <body>
  9.  <div id ="logo">
  10. <!----- insert logo below ------------------------------------------>
  11. <img src="img/sss.jpg"  height="123" width="100%" border="0" alt="">
  12. <!------------------------------------------------------------------>
  13. </div>
  14. <div>  </div>
  15. <div>  </div>
  16. <div>  </div>
  17. <div>  </div>
  18. <div>  </div>
  19.  <div id = "nav">
  20. <!----- menu, insert links below ------------------------------------------>
  21. <div id="menu4">
  22. <ul id="menulist1">
  23. <li><a href="home.html">home</a></li>
  24. <li><a href=" ">upload research </a></li>
  25. <li><a href=" ">view symposium schedule</a></li>
  26. <li><a href=" ">log out</a></li>
  27. </ul>
  28. </div>
  29. <!-------------------------------------------------------------------------->
  30. </div>
  31. <div id = "container">
  32. <div id="content">
  33. <td width="100%">
  34. <div class="P">
  35. <p> 
  36. <font size="5" color="#1c436c">&nbsp;&nbsp;&nbsp;&nbsp; Schedule for Presentions </font>
  37. </div>
  38. </p>
  39. </br>
  40. <div class="Sc">
  41. <table border="1" cellpadding="2" cellspacing="2" width="100%">
  42. <?php
  43.   $conn = mysql_connect("localhost","root","password");
  44. mysql_select_db("databasename", $conn);
  45.  $result = mysql_query("SELECT * FROM V")
  46. or die(mysql_error());  
  47. echo "<table border='1'>";
  48. echo "<tr> <th>Date</th> <th>Time</th><th>Research Title</th><th>Judge Name</th><th>Judge ID</th><th>Room</th> </tr> ";
  49. // keeps getting the next row until there are no more to get
  50. while($row = mysql_fetch_array( $result ))
  51.  {
  52.     // Print out the contents of each row into a table
  53.     echo "<tr><td>"; 
  54.     echo $row['Data'];
  55.     echo "</td><td>"; 
  56.     echo $row['Time'];
  57.     echo "</td><td>"; 
  58.     echo $row['ResearchTitle'];
  59.     echo "</td><td>";
  60.     echo $row['JudgeName'];
  61.     echo "</td><td>";
  62.     echo $row['JudgeID'];
  63.     echo "</td><td>";
  64.     echo $row['Room'];
  65.     echo "</td></tr>";
  66. }
  67. echo "</table>";
  68. mysql_close($conn);
  69. ?>
  70. </body>
  71. </html>
Dec 8 '11 #4

Post your reply

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