$max_capacity += intval($_POST['numberCapacity4']) * 4; } if (isset($_POST['hasCapacity6']) && $_POST['hasCapacity6'] === 'true') { $max_capacity += intval($_POST['numberCapacity6']) * 6; } if (isset($_POST['hasCapacity8']) && $_POST['hasCapacity8'] === 'true') { $max_capacity += intval($_POST['numberCapacity8']) * 8; } // echo $max_capacity; $fields = array('name' => $name, 'address' => $address, 'city' => $city, 'state' => $state, 'zipcode' => $zipcode, 'phone_number' => $phone_number, 'cuisine_type' => $cuisine_type, 'description' => $description, 'max_capacity' => $max_capacity, 'rating' => $rating, 'approved' => 0, 'owner_user_id' => $owner_user_id); try { $newRestaurant = new Restaurant(); $newRestaurant->create($fields); $success = true; $message = 'Restaurant sign up complete!'; $restaurant_id = $newRestaurant->get_restaurant_id(); // after insert restaurant info without errors // add image to images table require_once '../lib/helper.functions.php'; $image_client_path = $_FILES['file']['name']; $image_mime = $_FILES['file']['type']; $image_size = $_FILES['file']['size']; $image_error = $_FILES['file']['error']; $image_original_path = 'upload/original/'; $image_medium_path = 'upload/medium/'; $image_small_path = 'upload/small/'; $tmp_file = $_FILES["file"]["tmp_name"]; if ($image_error > 0) { throw new Exception('Image file is not correct!'); } else { date_default_timezone_set('UTC');