you'll have to forgive me for being naive, I assume this would go into my php code somewhere but I wouldn't know how to implement it.
This is the sql for the database with 4 entries for testing:
-- phpMyAdmin SQL Dump
-- version 2.10.0.2
--
http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 18, 2007 at 10:28 AM
-- Server version: 5.0.27
-- PHP Version: 5.2.1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `dmschen_isem`
--
-- --------------------------------------------------------
--
-- Table structure for table `calendar`
--
CREATE TABLE `calendar` (
`CalendarID` int(11) NOT NULL auto_increment,
`Date` date NOT NULL,
`EventDate` varchar(15) NOT NULL default '',
`EventDesc` text NOT NULL,
`EventLocation` varchar(50) NOT NULL default '',
`OnLine` tinyint(4) NOT NULL default '0',
PRIMARY KEY (`CalendarID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC COMMENT='ISEM Calendar of Events' AUTO_INCREMENT=5 ;
--
-- Dumping data for table `calendar`
--
INSERT INTO `calendar` (`CalendarID`, `Date`, `EventDate`, `EventDesc`, `EventLocation`, `OnLine`) VALUES
(1, '2007-06-13', '1', 'EACM Conference', 'Roseville, MI', 0),
(2, '2007-06-13', '1', 'Women''s Retreat', 'Ypsilanti, MI', 1),
(3, '2007-06-29', '26 - 28', 'Gospel Revival', 'Selfridge Chapel, MI', 0),
(4, '2007-08-15', '13 - 18', 'Couples Retreat', 'Selfridge', 1);
This is the code for the page with everything striped out:
<?php require_once('../Connections/ISEMCal.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;
}
}
mysql_select_db($database_ISEMCal, $ISEMCal);
$query_isemCal = "SELECT calendar.EventDate, calendar.EventDesc, calendar.EventLocation, calendar.`Date` FROM calendar GROUP BY (calendar.Date) ";
$isemCal = mysql_query($query_isemCal, $ISEMCal) or die(mysql_error());
$row_isemCal = mysql_fetch_assoc($isemCal);
$totalRows_isemCal = mysql_num_rows($isemCal);
function makeStamp($theString) {
if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $theString, $strReg)) {
$theStamp = mktime($strReg[4],$strReg[5],$strReg[6],$strReg[2],$strReg[3],$strReg[1]);
} else if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $theString, $strReg)) {
$theStamp = mktime(0,0,0,$strReg[2],$strReg[3],$strReg[1]);
} else if (ereg("([0-9]{2}):([0-9]{2}):([0-9]{2})", $theString, $strReg)) {
$theStamp = mktime($strReg[1],$strReg[2],$strReg[3],0,0,0);
}
return $theStamp;
}
function makeDateTime($theString, $theFormat) {
$theDate=date($theFormat, makeStamp($theString));
return $theDate;
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
</head>
<body>
<?php do { ?>
<table width="400" border="2" align="center" cellpadding="10" cellspacing="0">
<tr bgcolor="#E4C6E2">
<td colspan="2" class="monthYear"><div align="center"><?php echo makeDateTime($row_isemCal['Date'], 'F - Y'); ?></div></td>
</tr>
<tr valign="top">
<td width="30%"><p><?php echo $row_isemCal['EventDate']; ?></p></td>
<td width="70%"><?php echo $row_isemCal['EventDesc']; ?><br>
<?php echo $row_isemCal['EventLocation']; ?></td>
</tr>
</table>
<br>
<?php } while ($row_isemCal = mysql_fetch_assoc($isemCal)); ?>
</body>
</html>
<?php
mysql_free_result($isemCal);
?>
Thanks
Dave