Hi there,
I am making a little greeting card website and it allows customers to send cards for certain holidays (i.e. Thanksgiving, Christmas, Easter)...
The data gets stored in mysql as Y/N, if they want it sent for a specific holiday.
I have a page that shows all the customers and what they need, but its too much information. How can i make is display records if a holiday falls on this month.
Say if there is a Y in the thanksgiving row and the month = november then to show all the thanksgiving records.
Below is the code that queries all the data.
<?php require_once('Connections/my_conn.php');
require('includes/application_top.php');
include(DIR_WS_CLASSES . 'order.php');
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];
$maxRows_Recordset1 = 5;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_my_conn, $my_conn);
$query_Recordset1 = "SELECT card_schedule.first_name, card_schedule.last_name, card_schedule.address, card_schedule.city, card_schedule.`state`, card_schedule.zip, card_schedule.p_memo, card_schedule.birthday_date, card_schedule.birthday, card_schedule.christmas, card_schedule.new_years, card_schedule.halloween, card_schedule.labor_day, card_schedule.easter, card_schedule.thanksgiving, card_schedule.day_light_savings FROM card_schedule";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $my_conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
$queryString_Recordset1 = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . implode("&", $newParams);
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php
require(DIR_WS_INCLUDES . 'header.php');
?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">
<table width="93%" border="2">
<?php do { ?>
<tr>
<td bgcolor="#99CCFF"><div align="center"><strong>First
Name </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Last
Name </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Address</strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>City</strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>State</strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>
Zip</strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Personal
Memo </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Birth
Date</strong></div></td>
</tr>
<tr>
<td bgcolor="#99CCFF"><div align="center"><strong>Birthday
Card </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Christmas
Card </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>New
Years Card</strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Halloween
Card </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Labor
Day Card</strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Easter
Card </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Thanksgiving
Card </strong></div></td>
<td bgcolor="#99CCFF"><div align="center"><strong>Day
Light Savings Card</strong></div></td>
</tr>
<tr>
<td><div align="center"><?php echo $row_Recordset1['first_name']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['last_name']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['address']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['city']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['state']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['zip']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['p_memo']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['birthday_date']; ?></div></td>
</tr>
<tr>
<td><div align="center"><?php echo $row_Recordset1['birthday']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['christmas']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['new_years']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['halloween']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['labor_day']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['easter']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['thanksgiving']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset1['day_light_savings']; ?></div></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<div align="center"><a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
| <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
| <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
| <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a></div></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?><?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>