//
// conncet to database
// get next dance / current dance / specified (range) dance weekend
// get all dances with same weekend
// build table
// --------Caller
// --------Date / Level / Time / Location with map url
// include library
include_once "./PaceLib.php";
// connect to database
$adjDate = time() - (2 * 60 * 60);
$theStart = date("Y/m/d G:i:s", $adjDate);
//print $theStart;
$conn = connectPace();
//print $conn;
$select = mysql_select_db("theffron_PACE");
if (!$select) {
print mysql_error() . "
\n";
} // end if
$sql = "select weekend_id from dances where starts >= '" . $theStart . "' order by starts asc";
//print $sql;
$result = mysql_query($sql, $conn);
$row = mysql_fetch_assoc($result);
$theWkend = $row["weekend_id"];
// get the weekend name
$sql = 'select name from weekends where weekend_id = ' . $theWkend;
$result = mysql_query($sql, $conn);
$row = mysql_fetch_assoc($result);
$theWeekendName = $row["name"];
//get the dances
$sql = 'select DATE_FORMAT(ends,\'%a - %b %e, %Y\') as "Date"'
. ' , concat_ws(\' - \', DATE_FORMAT(starts, \'%l:%i %p\'), DATE_FORMAT(ends, \'%l:%i %p\')) as "Time"'
. ' , level as Level'
. ' , concat_ws(\' \', m.name_first, m.name_last) as Caller'
. ' , concat_ws(\' - \', h.name, h.address, h.city) as Address'
. ' , CONCAT(\'Map\') as Map'
. ' from dances d join callers c on d.callers_id = c.callers_id'
. ' join locations h on d.halls_id = h.halls_id'
. ' join levels l on l.levels_id = d.level_id'
. ' join members m on m.member_id = c.member_id'
. ' WHERE weekend_id = ' . $theWkend
. ' order by starts asc'
. ' LIMIT 0, 30'
. ' ';
$result = mysql_query($sql, $conn);
$numberofrows = mysql_numrows($result);
print "Based on " . date("m/d/y g:i:s a",$adjDate). " here on the West Coast
";
print "Our " . $theWeekendName . " weekend includes:
";
print "\n";
print "\n";
while ($field = mysql_fetch_field($result)) {
print "| $field->name | \n";
} // while end
print "
";
while ($row = mysql_fetch_assoc($result)) {
print "\n";
// look at each field
foreach ($row as $col=>$val) {
print " | $val | \n";
} // end foreach
print "
\n";
} // end while
print "
\n";
// print "";
// $today = getdate();
// print_r($today);
// $tc = date_default_timezone_get;
// print $tc;
// print "
";
?>
Return to Main Page