Jump to content

Mysql Delete problems


vlowe

Recommended Posts

Hello,

I am using PHP5, MySQL5 and APACHE2

i an trying to delete a row from a table useing the following syntax.

$query = "DELETE FROM cru_name WHERE id = $name_id";

$result = mysql_query($query) or die("Error number:" . mysql_errno() . "");
if($result){
echo "Name deleted from the database!";
} else {
$message = "Failed to delete! This is the MySQL Error output:<br>" + mysql_error();
}


For this i get an 1064 (Syntax) error, but i can not find the problem. i have used the same code on another server running apache and php4 (a hosting company) and still get the same error.

Permissions are fine and still get error as root.

If i type the mysql query into a mysql command line on my server it works, but via php i get the error??

??? ???

Any help would be fantastic  ;)
Link to comment
https://forums.phpfreaks.com/topic/27759-mysql-delete-problems/
Share on other sites

no i can see the id is correct in the url

$query = "DELETE FROM cru_name WHERE id = 10";

gives the same error  ??? ???

tried
$query = "DELETE FROM cru_name WHERE id = '10'";
also but same.

can someone post a definate working delete query with the 'mysql_query($query)' bits to execute it.

i will try that and see what i get
Link to comment
https://forums.phpfreaks.com/topic/27759-mysql-delete-problems/#findComment-127023
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.