Displaying Dates by Month
Posted: Tue Jan 13, 2009 12:55 pm
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
I have currently set up a page to display a list of upcoming performance dates. This can be viewed here:
http://www.kidsnightonbroadway.com/kids ... _month.php
Here is what the code currently looks like:
The query:
Here is the php to display the list:
I need to display any dates moving forward broken down by broadway then off-broadway and then by by month within the two. If anyone has any suggestions I would greatly appreciate some help on this.
Thanks in advance,
Andy
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
I have currently set up a page to display a list of upcoming performance dates. This can be viewed here:
http://www.kidsnightonbroadway.com/kids ... _month.php
Here is what the code currently looks like:
The query:
Code: Select all
<?php require_once('Connections/KidsNightOnBroadway.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<!-- Broadway show query -->
<?php
mysql_select_db($database_KidsNightOnBroadway, $KidsNightOnBroadway);
$query_Broadway_Shows = "SELECT shows.showName, shows.sortName, shows.broadwayOffbroadway, events.eventDate, MONTHNAME(events.eventDate) AS myMonth, YEAR(events.eventDate) AS myYear FROM shows, events WHERE shows.show='1' AND shows.broadwayOffbroadway='Broadway' AND shows.showCode = events.showcode AND events.eventDate >= curdate() ORDER BY events.eventDate, shows.sortName";
$Broadway_Shows = mysql_query($query_Broadway_Shows, $KidsNightOnBroadway) or die(mysql_error());
$row_Broadway_Shows = mysql_fetch_assoc($Broadway_Shows);
$totalRows_Broadway_Shows = mysql_num_rows($Broadway_Shows);
?>
<!-- Off Broadway show query -->
<?php
mysql_select_db($database_KidsNightOnBroadway, $KidsNightOnBroadway);
$query_OffBroadway_Shows = "SELECT shows.showName, shows.sortName, shows.broadwayOffbroadway, events.eventDate, MONTHNAME(events.eventDate) AS myMonth, YEAR(events.eventDate) AS myYear FROM shows, events WHERE shows.show='1' AND shows.broadwayOffbroadway='Off Broadway' AND shows.showCode = events.showCode and events.eventDate >= curdate() ORDER BY events.eventDate, shows.sortName";
$OffBroadway_Shows = mysql_query($query_OffBroadway_Shows, $KidsNightOnBroadway) or die(mysql_error());
$row_OffBroadway_Shows = mysql_fetch_assoc($OffBroadway_Shows);
$totalRows_OffBroadway_Shows = mysql_num_rows($OffBroadway_Shows);
?>
<?
$sortName=$_GET['sortName']
?>
<?php
mysql_select_db($database_KidsNightOnBroadway, $KidsNightOnBroadway);
$query_getShow = "SELECT * FROM shows WHERE shows.sortName='$sortName'";
$getShow = mysql_query($query_getShow, $KidsNightOnBroadway) or die(mysql_error());
$row_getShow = mysql_fetch_assoc($getShow); $totalRows_getShow = mysql_num_rows($getShow);
?>Code: Select all
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td width="33%"><strong>Show Date</strong></td>
<td width="67%"><strong>Show Name</strong></td>
</tr>
<?php do { ?> <tr>
<td><?php echo $row_Broadway_Shows['eventDate'] ?></td>
<td><em><a href="kids_display_show.php?sortName=<?php echo $row_Broadway_Shows['sortName']?>"><?php echo $row_Broadway_Shows['showName'] ?></a></em></td>
</tr><?php } while ($row_Broadway_Shows = mysql_fetch_assoc($Broadway_Shows)); ?>
</table>
<p><strong>Off-Broadway Shows</strong></p>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td width="33%"><strong>Show Date</strong></td>
<td width="67%"><strong>Show Name</strong></td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_OffBroadway_Shows['eventDate'] ?></td>
<td><em><a href="kids_display_show.php?sortName=<?php echo $row_OffBroadway_Shows['sortName']?>"><?php echo $row_OffBroadway_Shows['showName'] ?></a></em></td>
</tr>
<?php } while ($row_OffBroadway_Shows = mysql_fetch_assoc($OffBroadway_Shows)); ?>
</table>Thanks in advance,
Andy
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: