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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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