By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,442 Members | 1,580 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,442 IT Pros & Developers. It's quick & easy.

Problem with deleting from a database

P: n/a
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","$dbusername","$dbpasswd") ;
mysql_select_db("$dbname");
if(!$submit)
{
$result = mysql_query("select * from add_news order by id") or
die(mysql_error());
while($r=mysql_fetch_array($result))
{
$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($sql);
echo "News deleted!";
}?>
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


}?>
<input type="submit" value="submit" name="submit"></form>
<?
}
else // I get a Parse error: syntax error, unexpected T_ELSE (24)
{
$sql*=

--
Sat_
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.