I don't know PHP very well, so please bear with me.
My client has a database with information and one of the fields is ff_date_time in the format "Tue Oct 5 14:43:10 2010". There are a lot of entries in here and I need to display a list of just the days that have entries: ie,
- Tue Oct 5, 2010
- Thurs Oct 7, 2010
$query = "SELECT ff_date_time FROM booth_submit";
$query_result = mysql_query($query);
$datetimes = array();
$dates = array();
while ($row = mysql_fetch_array($query_result)) {
$datetimes[] = $row['ff_date_time'];
}
for ($i = 0; $i < sizeOf($datetimes); $i++) {
$temp = explode(" ", $datetimes[$i]);
$dates[] = ($temp[0]." ".$temp[1]." ".$temp[2]." ".$temp[4]); # Breaks date_time into 'Mon Oct 5 2010' format
}
$dates = array_unique($dates);
for ($i = 0; $i < sizeOf($dates); $i++) {
echo('<a href="#">'.$dates[$i].'</a><br />');
}
I'm doing a similar thing for two others fields that work fine, but for some reason, this always yields a $dates array that is the right length (ie: 4 unique dates, array is size 4), but only the first $dates element has any info. The output looks like this:
<a href="#">Mon Oct 3 2010</a><br />
<a href="#"></a><br />
<a href="#"></a><br />
<a href="#"></a><br />
When I don't use array_unique and just test values to check if everything is getting loaded and parsed correctly, the array is just as it should be ("Mon Oct 3 2010","Mon Oct 3 2010","Mon Oct 3 2010","Mon Oct 4 2010","Mon Oct 5 2010","Mon Oct 5 2010","Mon Oct 6 2010").
Any clues what's going wrong here?