FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Delete data from MySQL database problem!!





ranzon
Hi, i maded this scipt to delete data from an mySQL database, but when i use it, it just returns:

The code i using is this:

Quote:
Parse error: syntax error, unexpected T_VARIABLE in delete.php on line 15


Code:
<?

$username="";
$password="";
$database="";
$host="localhost";

$id = $_POST['id'];

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die(mysql_error());

$query = "'DELETE FROM `thexeption` WHERE `id` = '$id'"

$result=mysql_query($query);

mysql_close();
?>


I have checked that it returns data from $_POST['id'];

Please help me!!!
mathiaus
Try the following, you had a single quote before the DELETE
Code:
<?

$username="";
$password="";
$database="";
$host="localhost";

$id = $_POST['id'];

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die(mysql_error());

$query = "DELETE FROM `thexeption` WHERE `id`='$id'"

$result=mysql_query($query);

mysql_close();
?>
ranzon
I still get the same message.. Sad
mathiaus
ranzon wrote:
I still get the same message.. Sad


sorry I'm tied. you forgot the semi-colon for the delete line
Code:
$query = "DELETE FROM `thexeption` WHERE `id`='".$id."'";
ranzon
mathiaus wrote:
ranzon wrote:
I still get the same message.. Sad


sorry I'm tied. you forgot the semi-colon for the delete line
Code:
$query = "DELETE FROM `thexeption` WHERE `id`='".$id."'";


ahh thank you..
thats worked.. i'm too tired so i use long time to see wrong things.
openaasman
i think there could be mistake in single quote you are using try to balance the quote which i don't see equilize.
Related topics
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.