date_format yet again
| From: | boclair | Date: | Mon, 26 Mar 2001 08:40:39 +0000 |
| Subject: | date_format yet again | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7802@lists.php.net to get a copy of this message | ||
I realise that CC Zona answered this question earlier but I haven't
understood.
I have attempted to use the date_format in generating the query
variable and applying the result with a while loop to display the date
data in an html table as dd-mmm-yyyy
Generating the query variable
include ("inputs/connect.php");
$plantavail = mysql_query("SELECT regno, type, size, drive, mfr,
date_format(online,'%d-%b-%Y'), date_format(offline,'%d-%b-%Y') FROM
boclair.members where status='heavy' order by type, size");
And later the while loop
while ($myrow = mysql_fetch_array($plantavail)) {
printf('<tr>
<td class=regno align=right>%s</td>
<td class=type align=center>%s</td>
<td><span class=size>%s<span></td>
<td><span class=drive>%s<span></td>
<td><span class=mfr>%s<span></td>
<td><span class=date>%s<span></td>
<td><span class=date>%s<span></td>
</tr>
', $myrow['regno'], $myrow['type'], $myrow['size'],
$myrow['drive'], $myrow['mfr'], $myrow['online'],
$myrow['offline']);
}
The date_format function used this way generates no errors or warning
but the variables, $myrow['online'], $myrow['offline']), are empty and
the dates are not displayed in the html table.
Obviously I am missing the boat. The manual and references are
apparently beyond me.
Can I have some further help?
Tim Morris