$ingArray[] = $ingObj; //Add the object to the list } $i++; } /* Handle adding and editing of recipes */ $recipeObj = new Recipe($recipe_id, $recipe_name, $recipe_ethnic, $recipe_base, $recipe_course, $recipe_prep_time, $recipe_difficulty, $recipe_directions, $recipe_comments, $recipe_serving_size, $recipe_source, $recipe_source_desc, $SMObj->getUserID(), $recipe_private, $_FILES['recipe_picture'], $recipe_picture_type, $recipe_picture_oid); // Add or update the recipe $recipeObj->addUpdate(); // Handle the picture if ($remove_picture == "yes") { $recipeObj->deletePicture(); } else { $recipeObj->updatePicture($resize_picture); } if ($recipe_id) { // Clear out the old ingredients, this could be done by an update if desired. $sql = "DELETE FROM {$db_table_ingredientmaps} WHERE map_recipe=" . $DB_LINK->addq($recipe_id, get_magic_quotes_gpc()); $result = $DB_LINK->Execute($sql); // Also clear out the related_recipes $sql = "DELETE FROM {$db_table_related_recipes} WHERE related_parent=" . $DB_LINK->addq($recipe_id, get_magic_quotes_gpc()); $result = $DB_LINK->Execute($sql); } $recipe_id = $recipeObj->getID(); /* Add the ingredients into the database. The order field is needed because mysql does not consistently put them in or retrieve them in a specific order. */ foreach ($ingArray as $ing) {