"boclair" <[EMAIL PROTECTED]> wrote in message
000e01c0b5d0$720921c0$[EMAIL PROTECTED]">news:000e01c0b5d0$720921c0$[EMAIL PROTECTED]...
| 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']);
| }
Thanks but I found the answer at PHPBuilder Support forum. CCZona had
already given it to me but I need spoon feeding.
For the few that might also have a problem with reformatting the mysql
date for display in an html document, here is the answer and it works.
| $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");
should read
| $plantavail = mysql_query("SELECT regno, type, size, drive, mfr,
| date_format(online,'%d-%b-%Y') AS logon,
date_format(offline,'%d-%b-%Y') AS logoff FROM
| boclair.members where status='heavy' order by type, size");
and
| $myrow['drive'], $myrow['mfr'], $myrow['online'],
$myrow['offline']);
should read
| $myrow['drive'], $myrow['mfr'], $myrow['logon'], $myrow['logoff']);
Reference http://www.phpbuilder.com/forum/archives/2/2001/2/1/122514
Tim Morris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]