Hi
I got a little problem with deleting from my database, i'm making a
simple newsscript. I get a Parse error: syntax error, unexpected
T_ELSE on line 24, I have written the error as a comment further down
in the source delete_news.php on line 24.
Would be really nice if someone could help me on this :)
**** delete_news.php ****
<form method="get" action="delete_ news.php">
<?
include ("db.php");
mysql_connect(" $dbhost","$dbus ername","$dbpas swd");
mysql_select_db ("$dbname");
if(!$submit)
{
$result = mysql_query("se lect * from add_news order by id") or
die(mysql_error ());
while($r=mysql_ fetch_array($re sult))
{
$title=$r["title"];
$id=$r["id"];
?>
<INPUT TYPE="RADIO" NAME="id" VALUE="<?php echo $id;?>"><br>
<?php echo $id;?><br>
<?php echo $title;?><br>
<?
}?>
<input type="submit" value="submit" name="submit"></form>
<?
}?>
<?
else // I get a Parse error: syntax error, unexpected T_ELSE (24)
{
$sql = "DELETE FROM add_news WHERE id=$id";
$result = mysql_query($sq l);
echo "News deleted!";
}?>
I got a little problem with deleting from my database, i'm making a
simple newsscript. I get a Parse error: syntax error, unexpected
T_ELSE on line 24, I have written the error as a comment further down
in the source delete_news.php on line 24.
Would be really nice if someone could help me on this :)
**** delete_news.php ****
<form method="get" action="delete_ news.php">
<?
include ("db.php");
mysql_connect(" $dbhost","$dbus ername","$dbpas swd");
mysql_select_db ("$dbname");
if(!$submit)
{
$result = mysql_query("se lect * from add_news order by id") or
die(mysql_error ());
while($r=mysql_ fetch_array($re sult))
{
$title=$r["title"];
$id=$r["id"];
?>
<INPUT TYPE="RADIO" NAME="id" VALUE="<?php echo $id;?>"><br>
<?php echo $id;?><br>
<?php echo $title;?><br>
<?
}?>
<input type="submit" value="submit" name="submit"></form>
<?
}?>
<?
else // I get a Parse error: syntax error, unexpected T_ELSE (24)
{
$sql = "DELETE FROM add_news WHERE id=$id";
$result = mysql_query($sq l);
echo "News deleted!";
}?>
Comment