query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); $types[$id] = $type; } if ($_GET['r']) { $query = 'select id, name, short_name, sort_name, cuisine, url, featured, menu, has_coupon, coupon_start, coupon_stop, has_ad, ad_start, ad_stop, has_video from rest_restaurants where id = ' . $_GET['r']; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); extract ($res->fetch_assoc()); foreach(array('coupon_start', 'coupon_stop', 'ad_start', 'ad_stop') as $fld) { ${$fld} = (${$fld} == '1969-12-31' || ${$fld} == '0000-00-00') ? '' : date('n/j/Y', strtotime(${$fld})); } $head = $name; $action = 'Update'; $query = 'select id, address, address_descr, city, zip, phone, area from rest_address where rest_id = ' . $_GET['r']; if ($_GET['l']) { $query .= ' and id = \'' . $_GET['l'] . '\''; } if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { $locations[] = $row; } } else { $head = 'Add a restaurant'; $action = 'Add'; } $query = 'select id, area db_area from rest_areas'; if (!($res = $mysqli->query($query))) printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error); while ($row = $res->fetch_assoc()) { extract($row); $area_arr[$id] = $db_area; } $mysqli->close(); if ($featured) { $featured1 = ' checked'; $featured0 = ''; } else { $featured1 = ''; $featured0 = ' checked'; } //pprint_r($locations); ?>