Just a copy/paste of one of the previous codes, except for all the source codes
As long as i keep it “un-official”, then i THINK i can’t get into trouble
But then again, the church can request that i take down that thingy on the right side

While i’m at it, i may as well document everything i’m doing?

First thing, make the database

  `Date` date NOT NULL,
  `Special` varchar(255) NOT NULL,
  `PIC` varchar(45) NOT NULL,
  `P&W` varchar(45) NOT NULL,
  `Musician` varchar(45) NOT NULL,
  `Tech` varchar(45) NOT NULL,
  `Food/Cleaning` varchar(45) NOT NULL,
  PRIMARY KEY (`Date`)

After that, you need to insert the data?

/*!40000 ALTER TABLE `emyf` DISABLE KEYS */;
INSERT INTO `emyf` (`Date`,`Special`,`PIC`,`P&W`,`Musician`,`Tech`,`Food/Cleaning`) VALUES 
 ('2010-01-30','Welcome Night - Pot Luck, Talk and Games','Matt','Venus','Sally','Michelle','Everyone'),
 ('2010-02-06','Bible Study - Christian Beliefs','Sally','Matthew','Jeffrey','Aaron Wong','Sally'),
 ('2010-02-20','Bible Study - Christian Beliefs','Aaron Wong','Amos','Dylan','Anita','\"Jamie/Venus\"'),
 ('2010-02-27','Talk: Israel','Jamie','Jessica','Michelle','Nathan','Angie'),
 ('2010-03-06','Bible Study - Christian Beliefs','Vanessa ','Jeffrey','Matthew','Jensen','Sam'),
 ('2010-03-13','Asian - Quiz (Happy CNY!)','Jenny','Aaron W','Dylan','Kelvin','Jessica'),
 ('2010-03-20','Day Camp with EMP','-','-','-','-','-'),
 ('2010-03-27','Bible Study - Christian Beliefs','Jeffrey','Venus','Sally','John','Anita'),
 ('2010-04-03','Easterfest - Toowoomba','Amos/Jeffrey','-','-','-','-'),
 ('2010-04-10','Sisters\' Night','Kevin Yau','-','-','-','-'),
 ('2010-04-17','Bible Study - Christian Beliefs','Sally','Matthew','Jeffrey','Joey','Dylan'),
 ('2010-04-24','DVD Night','Michelle','Amos','Dylan','Angie','Jenny'),
 ('2010-05-01','Amazing race','Matthew','-','-','-','-'),
 ('2010-05-08','Parents\' Night','CMYF','-','-','-','-'),
 ('2010-05-15','Bible Study - Christian Beliefs','Aaron Wong','Amos ','Dylan','Joey','Jennifer'),
 ('2010-05-22','Birthday Night','Amos','Venus','Michelle','Jenny','Everyone'),
 ('2010-05-29','Bible Study - Christian Beliefs','Matthew','Vanessa','Jeffrey','Nathan','Michelle'),
 ('2010-06-05','Bible Study - Christian Beliefs','Sally','Aaron W','Dylan','Sam','Vanessa'),
 ('2010-06-12','Talk: Different Religions','Jamie','Matthew','Jeffrey','Anita','Jennifer'),
 ('2010-06-19','Games Night','Cindy','-','-','-','-'),
 ('2010-06-26','Kayaking ','Kelvin Lam','-','-','-','-');
/*!40000 ALTER TABLE `emyf` ENABLE KEYS */;

And do that afew times?

Next, comes the PHP

$conn = mysql_connect('localhost', 'joeylau_*****', '************');
if (!$conn) {echo "Unable to connect to DB: " . mysql_error();exit;}
if (!mysql_select_db("joeylau_admin")) {echo "Unable to select joey: " . mysql_error();exit;}
$sql = "SELECT * FROM emyf WHERE `Date`>='$date' LIMIT 1;";
$result = mysql_query($sql);
if (!$result) {echo "Could not successfully run query ($sql) from DB: " . mysql_error();exit;}
if (mysql_num_rows($result) == 0) {echo "No rows found, nothing to print so am exiting";exit;}
while ($row = mysql_fetch_assoc($result)) {
$mysqldate = $row["Date"];
$phpdate = strtotime( $mysqldate );
$mysqldate = date('d M', $phpdate);

echo '<table border="1">';
	echo '<tr><th>Date:</th><td>' . $mysqldate . '</td></tr>';
	echo '<tr><th>Special:</th><td>' . $row["Special"] . '</td></tr>';
	echo '<tr><th>PIC:</th><td>' . $row["PIC"] . '</td></tr>';
	echo '<tr><th>P&W:</th><td>' . $row["P&W"] . '</td></tr>';
	echo '<tr><th>Musician:</th><td>' . $row["Musician"] . '</td></tr>';
	echo '<tr><th>Tech:</th><td>' . $row["Tech"] . '</td></tr>';
	echo '<tr><th>Food/Cleaning:</th><td>' . $row["Food/Cleaning"] . '</td></tr>';
	echo '</table><br />';

Then, the last bit, add it to the site 😀

Leave a Reply