This is a discussion on Problem with deleting from a database within the PHP Language forums, part of the PHP Programming Forums category; Hi I got a little problem with deleting from my database, i'm making a simple newsscript. I get a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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!"; }?> |