iam Posted March 18, 2011 Share Posted March 18, 2011 <?php mysql_connect ("-","-","-") or die ('Error'); mysql_select_db ("-"); $out = mysql_query("SELECT * FROM guestbook ORDER BY id DESC"); while($row = mysql_fetch_assoc($out); --and this one if that braces is deleted { ----this is where im getting the error $name = $row['name']; $email = $row['email']; $txt = $row['comment']; $msg = "Are you sure you want to delete"; /* @var $_REQUEST <type> */ if (isset($_REQUEST ["action"]) && $_REQUEST["action"] == "del") { $id = intval($_REQUEST['id']); mysql_query("DELETE FROM guestbook WHERE id=$id;"); echo "<action=index.php>"; } echo "<font face='verdana' size='1'>"; echo "<table border='0'> <tr><td>Name: ".$name."</td></tr>"." <tr><td>Email: ".$email."</td></tr> <tr><td colspan='2'>Comment:</td></tr> <tr><td colspan='2' width='500'><b>".$txt."</b></td></tr> <tr><td><a onclick=\"return confirm('.$msg.');\" href='index.php?action=del&id=".$row['id']."'><span class='red'>["."Delete"."]</span></a> </td></tr> </table><br />"; echo "<hr size='1' width='500' align='left'></font>"; } ?> Kindly help me please. When i delete ({) the error will become the ( i dont know what to do already. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/231003-parse-error-syntax-error-unexpected-error-help/ Share on other sites More sharing options...
gristoi Posted March 18, 2011 Share Posted March 18, 2011 try: <?php mysql_connect ("-","-","-") or die ('Error'); mysql_select_db ("-"); $out = mysql_query("SELECT * FROM guestbook ORDER BY id DESC"); while($row = mysql_fetch_assoc($out)) { $name = $row['name']; $email = $row['email']; $txt = $row['comment']; $msg = "Are you sure you want to delete"; /* @var $_REQUEST <type> */ if (isset($_REQUEST ["action"]) && $_REQUEST["action"] == "del") { $id = intval($_REQUEST['id']); mysql_query("DELETE FROM guestbook WHERE id=$id;"); echo "<action=index.php>"; } echo "<font face='verdana' size='1'>"; echo "<table border='0'> <tr><td>Name: ".$name."</td></tr>"." <tr><td>Email: ".$email."</td></tr> <tr><td colspan='2'>Comment:</td></tr> <tr><td colspan='2' width='500'><b>".$txt."</b></td></tr> <tr><td><a onclick=\"return confirm('.$msg.');\" href='index.php?action=del&id=".$row['id']."'><span class='red'>["."Delete"."]</span></a> </td></tr> </table><br />"; echo "<hr size='1' width='500' align='left'></font>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/231003-parse-error-syntax-error-unexpected-error-help/#findComment-1189111 Share on other sites More sharing options...
iam Posted March 18, 2011 Author Share Posted March 18, 2011 gristoi i do know that, i just used a dash for the host, username, password and database when i deleted the details on there. Quote Link to comment https://forums.phpfreaks.com/topic/231003-parse-error-syntax-error-unexpected-error-help/#findComment-1189115 Share on other sites More sharing options...
joshbedo Posted March 18, 2011 Share Posted March 18, 2011 Where is your closing bracket for your while loop and where is your opening bracket for your if statement Quote Link to comment https://forums.phpfreaks.com/topic/231003-parse-error-syntax-error-unexpected-error-help/#findComment-1189118 Share on other sites More sharing options...
gristoi Posted March 18, 2011 Share Posted March 18, 2011 I dont understand what you are on about. the issue you had was with while($row = mysql_fetch_assoc($out); <--- you had a semi colon and were missing a ')' So i fixed that and reported your code. So please read through you code before saying you already know. If you 'already knew' then you wouldnt have posted your issue on the forum Quote Link to comment https://forums.phpfreaks.com/topic/231003-parse-error-syntax-error-unexpected-error-help/#findComment-1189119 Share on other sites More sharing options...
iam Posted March 18, 2011 Author Share Posted March 18, 2011 I dont understand what you are on about. the issue you had was with while($row = mysql_fetch_assoc($out); <--- you had a semi colon and were missing a ')' So i fixed that and reported your code. So please read through you code before saying you already know. If you 'already knew' then you wouldnt have posted your issue on the forum Sorry. Im new here. I thought this was your your comment -To err is human... to really foul up requires the root password and i thought you were referring to those dashes. By the way, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/231003-parse-error-syntax-error-unexpected-error-help/#findComment-1189121 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.