ziggy1621
01-02-2008, 03:56 PM
i'm currently pulling the field 'departDate' from mysql as YYYY-MM-DD (it is saved as date format). I'm using the following function to reformat it for display:
<?
function reformat_date($date, $format){
$output = date($format, strtotime($date));
return $output;
}
$departDate= reformat_date($departDate, "F j, Y");
?>
The problem is, when i'm trying to display multiple items using the following, I get an error that it "Cannot redeclare reformat_date() (previously declared.."
this is what I have:
while ( $aRow = mysql_fetch_array( $aQResult ) )
{
$departDate=$aRow["departDate"];
////reformat date
function reformat_date($date, $format){
$output = date($format, strtotime($date));
return $output;
}
$departDate= reformat_date($departDate, "F j, Y");
print($departDate);
}
mysql_free_result( $aQResult );
thanks in advance for any help
<?
function reformat_date($date, $format){
$output = date($format, strtotime($date));
return $output;
}
$departDate= reformat_date($departDate, "F j, Y");
?>
The problem is, when i'm trying to display multiple items using the following, I get an error that it "Cannot redeclare reformat_date() (previously declared.."
this is what I have:
while ( $aRow = mysql_fetch_array( $aQResult ) )
{
$departDate=$aRow["departDate"];
////reformat date
function reformat_date($date, $format){
$output = date($format, strtotime($date));
return $output;
}
$departDate= reformat_date($departDate, "F j, Y");
print($departDate);
}
mysql_free_result( $aQResult );
thanks in advance for any help