473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Parse error: syntax error, unexpected $end in E:\wamp\www\forums\view_topic.php on li

I am getting the following error:
Parse error: syntax error, unexpected $end in E:\wamp\www\forums\view_topic.php on line 138
And i am a newbie..
I have been working on the code for ages and now it dosent work!!!

HELP


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $host="localhost"; // Host name 
  3. $username="root"; // Mysql username 
  4. $password=""; // Mysql password 
  5. $db_name="forum"; // Database name 
  6. $tbl_name="forum_question"; // Table name
  7.  
  8. // Connect to server and select database.
  9. mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
  10. mysql_select_db("$db_name")or die("cannot select DB");
  11.  
  12.  
  13. // get value of id that sent from address bar 
  14. $id=$_GET['id'];
  15.  
  16. $sql="SELECT * FROM $tbl_name WHERE id='$id'";
  17. $result=mysql_query($sql);
  18.  
  19. $rows=mysql_fetch_array($result);
  20. ?>
  21. <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  22. <tr>
  23. <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF">
  24. <tr>
  25. <td bgcolor="#F8F7F1"><strong><?php echo $rows['topic']; ?></strong></td>
  26. </tr>
  27.  
  28. <tr>
  29. <td bgcolor="#F8F7F1"><?php echo $rows['detail']; ?></td>
  30. </tr>
  31.  
  32. <tr>
  33. <td bgcolor="#F8F7F1"><strong>By :</strong> <?php echo $rows['name']; ?> <strong>Email : </strong><?php echo $rows['email'];?></td>
  34. </tr>
  35.  
  36. <tr>
  37. <td bgcolor="#F8F7F1"><strong>Date/time : </strong><?php echo $rows['datetime']; ?></td>
  38. </tr>
  39. </table></td>
  40. </tr>
  41. </table>
  42. <BR>
  43. <?php
  44. $tbl_name2="forum_answer"; // Switch to table "forum_answer"
  45.  
  46. $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";
  47. $result2=mysql_query($sql2);
  48.  
  49. while($rows=mysql_fetch_array($result2)){
  50. ?>
  51. <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  52. <tr>
  53. <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  54. <tr>
  55. <td bgcolor="#F8F7F1"><strong>ID</strong></td>
  56. <td bgcolor="#F8F7F1">:</td>
  57. <td bgcolor="#F8F7F1"><?php echo $rows['a_id']; ?></td>
  58. </tr>
  59. <tr>
  60. <td width="18%" bgcolor="#F8F7F1"><strong>Name</strong></td>
  61. <td width="5%" bgcolor="#F8F7F1">:</td>
  62. <td width="77%" bgcolor="#F8F7F1"><?php echo $rows['a_name']; ?></td>
  63. </tr>
  64. <tr>
  65. <td bgcolor="#F8F7F1"><strong>Email</strong></td>
  66. <td bgcolor="#F8F7F1">:</td>
  67. <td bgcolor="#F8F7F1"><?php echo $rows['a_email']; ?></td>
  68. </tr>
  69. <tr>
  70. <td bgcolor="#F8F7F1"><strong>Answer</strong></td>
  71. <td bgcolor="#F8F7F1">:</td>
  72. <td bgcolor="#F8F7F1"><?php echo $rows['a_answer']; ?></td>
  73. </tr>
  74. <tr>
  75. <td bgcolor="#F8F7F1"><strong>Date/Time</strong></td>
  76. <td bgcolor="#F8F7F1">:</td>
  77. <td bgcolor="#F8F7F1"><?php echo $rows['a_datetime']; ?></td>
  78. </tr>
  79. </table></td>
  80. </tr>
  81. </table><br>
  82.  
  83. <?
  84. }
  85.  
  86. $sql3="SELECT view FROM $tbl_name WHERE id='$id'";
  87. $result3=mysql_query($sql3);
  88.  
  89. $rows=mysql_fetch_array($result3);
  90. $view=$rows['view'];
  91.  
  92. // if have no counter value set counter = 1
  93. if(empty($view)){
  94. $view=1;
  95. $sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";
  96. $result4=mysql_query($sql4);
  97. }
  98.  
  99.  
  100. // count more value
  101. $addview=$view+1;
  102. $sql5="update $tbl_name set view='$addview' WHERE id='$id'";
  103. $result5=mysql_query($sql5);
  104.  
  105. mysql_close();
  106. ?>
  107.  
  108. <BR>
  109. <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  110. <tr>
  111. <form name="form1" method="post" action="add_answer.php">
  112. <td>
  113. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  114. <tr>
  115. <td width="18%"><strong>Name</strong></td>
  116. <td width="3%">:</td>
  117. <td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td>
  118. </tr>
  119. <tr>
  120. <td><strong>Email</strong></td>
  121. <td>:</td>
  122. <td><input name="a_email" type="text" id="a_email" size="45"></td>
  123. </tr>
  124. <tr>
  125. <td valign="top"><strong>Answer</strong></td>
  126. <td valign="top">:</td>
  127. <td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td>
  128. </tr>
  129. <tr>
  130. <td>&nbsp;</td>
  131. <td><input name="id" type="hidden" value="<?php echo $id; ?>"></td>
  132. <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
  133. </tr>
  134. </table>
  135. </td>
  136. </form>
  137. </tr>
  138. </table>
The last line in 139
Dec 23 '11 #1
1 5733
Dormilich
8,658 Expert Mod 8TB
that error usually comes up if there is a bracket mismatch (e.g. missing })
Dec 23 '11 #2

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

Similar topics

8
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
5
praclarush
by: praclarush | last post by:
I've just started php, and this is a class assignment, but my question is I’m getting this error PHP Parse error: syntax error, unexpected T_IF, expecting T_VARIABLE or '$' in...
9
by: ajd335 | last post by:
Hi all... I am getting an error Parse error: syntax error, unexpected $end in http:/..... on line 117...(117 is the EOF).. can you plz help me out..I have checked out for the < , > ,{ ,} etc.......
9
akohistani
by: akohistani | last post by:
I am having Parse error problem with my newly purchased Php upload script I have uploaded the script and I get the error below Parse error: syntax error, unexpected $end in URL/functions.php on...
10
by: benicio | last post by:
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19 I got this error and this syntax is from 8 to 19th line. <?php ...
2
by: TanjaPetro | last post by:
Hello to everyone. I changed a few files on my site and when I tried to log into the admin area I got this message: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting...
13
Topbidder
by: Topbidder | last post by:
I have this error on the code Parse error: syntax error, unexpected '"' in /home/topbidd/public_html/bid2/bid_classic.php on line 159 now i thought the error was this It seems that the...
3
by: CYNTHIA CUTRER | last post by:
<!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" xml:lang="en"> <head> ...
5
by: vultren | last post by:
Parse error: syntax error, unexpected $end in I keep getting that, I have no clue where to fix it. Any help would be VERY APPRECIATED! <?php if(isset($_POST)) { // EDIT THE 2 LINES...
3
by: Ann Madden | last post by:
Hello - I am super green to php and mysql. I have received the following error: Parse error: syntax error, unexpected $end in C:\website\chart.php on line 84... I have been through the code matching...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.