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

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

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.