Hi,
I'm trying to set up an excel table that pulls information out of a PostgreSQL data base, The basic code is here:
<?
session_start();
require_once '../system/definitions.pso';
$user_list = PG_SQLGet(" SELECT *
FROM users
ORDER BY user_id ASC");
header("Expires: 0");
header("Cache-control: private");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Description: File Transfer");
header("Content-Type: application/ms-excel");
header("Content-disposition: attachment; filename=user_details.xls");
?>
<table cellpadding="5" cellspacing="0" border="1">
<tr>
<td>User ID</td>
<td>First name</td>
<td>Surname</td>
<td>Join date</td>
</tr>
<?
for ($i = 0; $i < count($user_list); $i++): ?>
<tr>
<td><?=strip_tags($user_list[$i]["user_id"])?></td>
<td><?=strip_tags($user_list[$i]["first_name"])?></td>
<td><?=strip_tags($user_list[$i]["surname"])?></td>
<td><?=strip_tags($user_list[$i]["user_join_date"])?></td>
</tr>
<? endfor; ?>
</table>
This works but I have one problem. The "user_join_date" field is a timestamp in PostgreSQL and as a result gives '19:04' in its column and not '16/03/2009 17:19:04' (for example)
I'm sure I'm missing something obvious but could you tell me what it is>?!?
I'm trying to set up an excel table that pulls information out of a PostgreSQL data base, The basic code is here:
<?
session_start();
require_once '../system/definitions.pso';
$user_list = PG_SQLGet(" SELECT *
FROM users
ORDER BY user_id ASC");
header("Expires: 0");
header("Cache-control: private");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Description: File Transfer");
header("Content-Type: application/ms-excel");
header("Content-disposition: attachment; filename=user_details.xls");
?>
<table cellpadding="5" cellspacing="0" border="1">
<tr>
<td>User ID</td>
<td>First name</td>
<td>Surname</td>
<td>Join date</td>
</tr>
<?
for ($i = 0; $i < count($user_list); $i++): ?>
<tr>
<td><?=strip_tags($user_list[$i]["user_id"])?></td>
<td><?=strip_tags($user_list[$i]["first_name"])?></td>
<td><?=strip_tags($user_list[$i]["surname"])?></td>
<td><?=strip_tags($user_list[$i]["user_join_date"])?></td>
</tr>
<? endfor; ?>
</table>
This works but I have one problem. The "user_join_date" field is a timestamp in PostgreSQL and as a result gives '19:04' in its column and not '16/03/2009 17:19:04' (for example)
I'm sure I'm missing something obvious but could you tell me what it is>?!?