URL Date Searching

5 posts by 2 authors in: Forums > CMS Builder
Last Post: September 9, 2009   (RSS)

Re: [sagentic] URL Date Searching

By Chris - September 8, 2009

Hi Kenny,

Can you post the PHP source code for your local.php page please?
All the best,
Chris

Re: [chris] URL Date Searching

By Kenny - September 8, 2009 - edited: September 8, 2009

<?php require_once "/home/soccer/public_html/webadmin/lib/viewer_functions.php";

list($local_schedulesRecords, $local_schedulesMetaData) = getRecords(array(
'tableName' => 'local_schedules',
));

?>
<?php include_once "/home/network/public_html/sep/index.php" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Cleburne Soccer Association | Schedules</title>
<link rel="shortcut icon" href="../favicon.ico">
<link rel="alternate" type="application/rss+xml" title="Sitemap" href="../sitemap.xml">

</head>

<body link="#0000FF" vlink="#0000FF" alink="#0000FF">

<div align="center"><table border="0" cellpadding="3" cellspacing="3" width="675" id="table1">

<tr>
<td bgcolor="#000000" width="71"><b>
<font size="2" face="Arial" color="#FFFFFF">Age Group</font></b></td>
<td bgcolor="#000000" width="172"><b>
<font size="2" face="Arial" color="#FFFFFF">Date</font></b></td>
<td bgcolor="#000000" width="91"><b>
<font size="2" face="Arial" color="#FFFFFF">Time</font></b></td>
<td bgcolor="#000000" width="130"><b>
<font size="2" face="Arial" color="#FFFFFF">Home Team</font></b></td>
<td bgcolor="#000000" width="132"><b>
<font size="2" face="Arial" color="#FFFFFF">Away Team</font></b></td>
<td bgcolor="#000000"><b>
<font size="2" face="Arial" color="#FFFFFF">Field</font></b></td>
</tr>
<?php foreach ($local_schedulesRecords as $record): ?>
<tr>
<td width="71"><font size="2" face="Arial"><?php echo $record['age_group'] ?></font></td>
<td width="172"><font size="2" face="Arial"><?php echo date("D, M d, Y", strtotime($record['date'])) ?></font></td>
<td width="91"><font size="2" face="Arial"><?php echo date("g:i a", strtotime($record['date'])) ?></font></td>
<td width="130"><font size="2" face="Arial"><a href="schedules/local.php?home_team,away_team_keyword=<?php echo $record['home_team'] ?>"><?php echo $record['home_team'] ?></a></font></td>
<td width="132"><font size="2" face="Arial"><a href="schedules/local.php?home_team,away_team_keyword=<?php echo $record['away_team'] ?>"><?php echo $record['away_team'] ?></a></font></td>
<td><font size="2" face="Arial"><?php echo $record['field'] ?></font></td>
</tr>
<?php endforeach; ?>
</table>
</div>

</body>

</html>

Re: [sagentic] URL Date Searching

By Chris - September 8, 2009

Hi Kenny,

You'll need to use the same format for your date that MySQL uses.

<a href="?date=<?php echo date("Y-m-d", strtotime($record['date'])) ?>">

If your date fields are also keeping track of time, you'll need to search with the _prefix operator:


<a href="?date_prefix=<?php echo date("Y-m-d", strtotime($record['date'])) ?>">

I hope this helps! :)
All the best,
Chris

Re: [chris] URL Date Searching

By Kenny - September 9, 2009

That worked great Chris - thanks!