Jump to content

Parse error: syntax error, unexpected '{' Error Help


iam

Recommended Posts

<?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.

Link to comment
Share on other sites

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>";
}
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.