query('delete from rest_address where address = \'\' and city = \'\' and zip = \'\' and phone = \'\''))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); $query = 'select id from rest_address where rest_id = \'' . $restaurant_id . '\''; pecho($query); if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); # list ($location_id) = $res->fetch_row(); # if (!($location_id)) # { # $query = 'insert into rest_address (id, rest_id, address) values (null, \'' . $restaurant_id . '\', \'New location\')'; # if (!($res = $mysqli->query($query))) # printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); # $location_id = $mysqli->insert_id; # } header("Location: upload_restaurant.html?l=$location_id&r=$restaurant_id"); } $locationMenuArray = $restaurantTypeArray = array(); $selRestaurantID = $selLocationID = ''; $action = 'Add'; if ($_GET['r'] || $selRestaurantID) { $selRestaurantID = ($_GET['r']) ? $_GET['r'] : $selRestaurantID; $query = 'select id from rest_address where rest_id = \'' . $selRestaurantID . '\''; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); $count = $res->num_rows; if ($count == 1) { list ($selLocationID) = $res->fetch_row(); } else { $locationMenuArray = buildLocationMenu($selRestaurantID); $query = 'select r.name, r.cuisine, r.url from rest_restaurants r where r.id = \'' . $selRestaurantID . '\''; #pecho($query); if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); list ($name, $cuisine, $url) = $res->fetch_row(); } $action = 'Edit'; } function buildLocationMenu($selRestaurantID) { global $mysqli; $query = 'select a.id locationID, a.address addr, a.phone phone from rest_address a where a.rest_id = \'' . $selRestaurantID . '\''; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); $b_array = array(); if ($addr) { $b_array[] = $addr; } if ($phone) { $b_array[] = $phone; } $locationMenuArray[$locationID] = implode(', ', $b_array); } return $locationMenuArray; } if ($_GET['l'] <> 0 || $selLocationID) { $selLocationID = ($_GET['l']) ? $_GET['l'] : $selLocationID; $query = 'select r.id, r.name, a.address, a.city, a.zip, a.phone, r.cuisine, r.sort_name, r.short_name from rest_restaurants r, rest_address a where a.rest_id = r.id and a.id = \'' . $selLocationID . '\''; #pecho($query); if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); list ($selRestaurantID, $name, $addr, $city, $zip, $phone, $cuisine, $sort, $short) = $res->fetch_row(); $locationMenuArray = buildLocationMenu($selRestaurantID); $action = 'Edit'; } $query = 'select id, type from rest_cuisine order by type'; #pecho($query); if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); $restaurantTypeArray[$id] = $type; } $mysqli->close(); $txtName = ($name) ? $name : ''; $txtAddr = ($addr) ? $addr : ''; $txtCity = ($city) ? $city : ''; $txtZip = ($zip) ? $zip : ''; $txtPhone = ($phone) ? $phone : ''; $txtSortName = ($sort) ? $sort : ''; $txtShortName = ($short) ? $short : ''; $anagency = ($txtName) ? $txtName : 'Add a restaurant'; ?> Daily Courier Restaurant Add/Update Page
Show Intro

Enter the information for the new agency.

The Restaurant name is mandatory. Address, City, St ZIP and Phone are optional, but at least one should be included. If there's a Web site associated with the restaurant listing, include the Web URL, but don't enter the "http://" part.


1) { echo '
Branch:
' . "\n"; } if ($_GET || $_POST) { echo '      Add a branch' . "\n"; } if ($_GET['l']) { $displayRestaurantName = '' . $txtName . ''; } else { $displayRestaurantName = ''; } ?>
Restaurant type: 
Restaurant name: 
Sort name: 
Short name: 
Address: 
City: 
ZIP: 
Phone: 
Web site URL:  http://(don't include the "http://"; it's implied)

' . "\n"; } else { echo '' . "\n"; } ?>
Logo: ".jpg" or ".gif" file:  
 (jpg or gif, 72 dpi, RGB, 1” (72pt) height max.)
 

[return to admin]