Problem with deleting from a database

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


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-21-2004
Sebastian
 
Posts: n/a
Default Problem with deleting from a database

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!";
}?>
Reply With Quote
  #2 (permalink)  
Old 10-21-2004
sathia
 
Posts: n/a
Default Re: Problem with deleting from a database



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

--
Sat_
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:04 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0