The following code is used so that I enter a date in format YYYY-MM-DD, it will then display any rows of data that contain that information. I am forced to enter a date.
The code was sent to me by another person on this board, and I've been modifying it to work, all good so far!, but I don't know how to make the change I need to this time.
I need to change it so that it does not require me to enter a date. I need to be able to enter a word that will catergorize the data in the schedule table. ie: Mo, Bonnie, Phil, etc, etc instead of YYYY-MM-DD
Thank you for any assistance!
Landis
// get schedule data
function getSchedule($conn,$scheduledate) {
$matches = array();
$retVal = array();
if (preg_match("§(\d{4})-(\d{2})-(\d{2})§",$scheduledate,$matches) && checkdate($matches[2],$matches[3],$matches[1])) {
$sql =<<<EOSQL
SELECT id, `date`, `time`, trim(concat(`date`, ' ' ,`time`)) as datetime,
location, home, visitor, age, referee, ar1, ar2
FROM schedule
WHERE `gamecode`='$scheduledate'
ORDER BY datetime
EOSQL;
$res = @mysql_query($sql,$conn) or die("SQL error (schedule): ".mysql_error());
while ($row = mysql_fetch_assoc($res)) {
$retVal[$row['id']] = $row;
}
}
return $retVal;
}