herghost Posted September 24, 2009 Share Posted September 24, 2009 Hi all, can a fresh pair of eyes see my mistake? The error is reported on line 119 which is the last line and I can not spot it anywhere in the code <?php session_start(); include('../include/dbconnect.php'); $id=$_GET['id']; $sql="SELECT * FROM forum_question WHERE id='$id'"; $result=mysql_query($sql) or die ("fucked" .mysql_error()) ; while($rows=mysql_fetch_array($result)) { ?> <p> <h1> <?php echo $rows['title'];?> </h1> <table> <tr> <th>System Info: </th><td>Operating System: <?php echo $rows['os'] ;?>,<br /> Amount of Ram: <?php echo $rows['ram'] ;?>,<br /> Harddrive Type & Size: <?php echo $rows['harddrive'] ;?>, <br /> Graphics Card: <?php echo $rows['graphics'] ;?></td> </tr> <tr> <th>Topic: </th><td> <?php echo $rows['title'] ;?> </td> </tr> <tr> <th>Posted By: </th><td> <?php echo $rows['username'] ;?> </td> </tr> <tr> <th>Posted On: </th><td> <?php echo $rows['datetime'] ;?> </td> </tr> <br /> <tr> <th>Description: </th><td> <?php echo $rows['detail'];?> </td> </tr> <?php } ?> <tr> <th>Download DxDIAG: </th> <?php $query = "SELECT id, name FROM upload WHERE post_no = '$id'"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "No DxDIAG Exists <br>"; } else { while(list($id, $name) = mysql_fetch_array($result)) { ?> <td><a href="javascript:ajaxpage('forum/download.php?id= <?php echo $id; ?>', 'main');">Download</a><td><br> <?php } } ?> <tr></tr> <tr></tr> <tr> <th><a href="javascript:ajaxpage('forum/solutions.php','main');">Back</a></th> </tr> </table> <p> <?php // Switch to table "forum_answer" $sql2="SELECT * FROM forum_answer WHERE question_id='$id'"; $result2=mysql_query($sql2); while($rows=mysql_fetch_array($result2)){ ?><br> <?php $sql3="SELECT view FROM forum_question WHERE id='$id'"; $result3=mysql_query($sql3); $rows=mysql_fetch_array($result3); $view=$rows['view']; // if have no counter value set counter = 1 if(empty($view)){ $view=1; $sql4="INSERT INTO forum_question(view) VALUES('$view') WHERE id='$id'"; $result4=mysql_query($sql4); } // count more value $addview=$view+1; $sql5="update forum_question set view='$addview' WHERE id='$id'"; $result5=mysql_query($sql5); ?> </p> <form method="post" action="forum/add_answer.php?id=<?php echo $id ; ?>"> <p> <label><?php echo $_SESSION['username']; ?>'s Reply</label> <textarea rows="5" cols="5" name="answer" id="answer"></textarea> <input name="id" type="hidden" value="<?php echo $id ;?>" /> <input class="button" type="submit" /> </p> </form> Link to comment https://forums.phpfreaks.com/topic/175367-parse-error-cant-see-it/ Share on other sites More sharing options...
Bricktop Posted September 24, 2009 Share Posted September 24, 2009 Hi herghost, On line 78 you have: while($rows=mysql_fetch_array($result2)){ Which you are not closing. Stick a } on line 102 before the final ?> and it should fix the problem. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/175367-parse-error-cant-see-it/#findComment-924137 Share on other sites More sharing options...
herghost Posted September 24, 2009 Author Share Posted September 24, 2009 Hi Mate, I can now see the page again, however it has stopped counting and adding views to the database? Any ideas on that one?! Link to comment https://forums.phpfreaks.com/topic/175367-parse-error-cant-see-it/#findComment-924142 Share on other sites More sharing options...
Bricktop Posted September 24, 2009 Share Posted September 24, 2009 Hi herghost, You say it has "stopped" but I can't see that it ever worked before with the missing } Is the "view" row in the database being populated with anything? Link to comment https://forums.phpfreaks.com/topic/175367-parse-error-cant-see-it/#findComment-924157 Share on other sites More sharing options...
herghost Posted September 24, 2009 Author Share Posted September 24, 2009 Hi, Sorry, originally I had an image upload script instead of a standard file upload and the counter worked. Now it is just sitting at 0, the default in the database. Fell like i am going backwards! Link to comment https://forums.phpfreaks.com/topic/175367-parse-error-cant-see-it/#findComment-924164 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.