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.

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

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

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.