function sync_all_dishes_ingredients() { $query = "SELECT `id` FROM `dishes`"; $res = common_query($query, __FILE__, __LINE__); if (!$res) { return 0; } while ($arr = mysql_fetch_array($res)) { $dish = new dish($arr['id']); if ($err = $dish->sync_dish_ingredients()) { return $err; } } return 0; }