'; // *** Date format $dateformat = 'F j, Y'; // *** What should I echo if tickets are sold out? $soldout = 'Sold Out!'; // *** Selects data from tours if (!empty($type)) { $sql = "SELECT * FROM tours WHERE type = '$type' ORDER BY date ASC"; } else { $sql = "SELECT * FROM tours ORDER BY type, date ASC"; } // *** If the ID is set get only data for that item if ($id) { $sql = "SELECT * FROM tours WHERE id = '$id'"; } $result = MYSQL_QUERY($sql); $rows = MYSQL_NUM_ROWS($result); while ($v<$rows) { $data[$v] = mysql_fetch_array($result); // *** Echos the data with $linebreak afterwards if ($array == 'echo') { // *** Echos the date in $dateformat format if ($field == 'date') { echo date($dateformat,$data[$v][$field]).$linebreak; } else { // *** Echos the number of tickets or $soldout if zero if ($data[$v][$field] == '0') { echo $soldout.$linebreak; } else { echo $data[$v][$field].$linebreak; } } } $v++; } // *** Returns full data in an array if ($array == 'array') { return $data; } } // *** Returns specific items (fields) function getSpecificTour($row,$field,$id) { $data = getTour('','','array',$id); return $data[$row][$field]; } // *************************** // // *** TICKER FUNCTION ******* // // *************************** // function showTicker() { // *** Selects text from the table ticker $sql = "SELECT text FROM ticker ORDER BY id DESC"; $result = MYSQL_QUERY($sql); $rows = MYSQL_NUM_ROWS($result); while ($v<$rows) { $data[$v] = mysql_fetch_array($result); // *** Echos the field return $data[$v]['text']; $v++; } } // *************************** // // *** OTHER FUNCTIONS ******* // // *************************** // // *** This function selects the appropriate field in the list boxes function doDateSelect($field,$type,$id) { if ($type == 'month') { if ($field == strtolower(date("F",getSpecificTour('','date',$id)))) { return "selected=\"selected\""; } } if ($type == 'day') { if ($field == date("d",getSpecificTour('','date',$id))) { return "selected=\"selected\""; } } if ($type == 'year') { if ($field == date("Y",getSpecificTour('','date',$id))) { return "selected=\"selected\""; } } } function showYears($id) { // *** Set number of years past current $numYears = 10; // *** loop through years for option fields for ($i = 0; $i < $numYears+1; $i++) { $timestamp = strtotime("+".$i." years"); // echo the years and also use the doDataSelect to set selected (only if $id is set) if (!empty($id)) { echo ""; } else { echo ""; } } } ?>