Jump to content

not sure why this error message is coming up


jeppers

Recommended Posts

//chck the form has been submitted 
if (isset($_POST['submitted'])) {

if ($_POST['sure'] == 'yes') { //delete them 

	//make the query
	$query = "DELETE foods, food_associations FROM foods, food_associations 
			  WHERE foods.food_id='$id' AND food_associations.food_id ='$id'";		
	$result = @mysql_query ($query) or die(mysql_error()); // Run the query.
	if (mysql_affected_rows() == 1) { // If it ran OK

		//print the message 
		echo '<h1 "> Delete a food</h1>
		<p>The food has been deleted.</p><p><br /><br /></p>';

	}else{ //if the query did not run ok 
		echo '<h1 ">Sytem error</h1>
		<p class="error">The food could not be deleted due to a system error.</p>'; // public message 
		echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; //debugging message.
	}

 

The code above works and the query is correct. but every time i try to delete it comes up with this message "The food could not be deleted due to a system error"

 

i then check the database and it has been deleted.

 

can u have a look at the code and see if it something very simple

 

thanks

Link to comment
Share on other sites

what a fool this is the error

 

$result = @mysql_query ($query) or die(mysql_error()); // Run the query.

      if (mysql_affected_rows() == 1) { // If it ran OK

 

the query is effection 2 rows not one so all done

 

thanks for all your help today

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.