I am displaying date fields that i get from a MS Access database. I Query the database and when i output the information the fields that are stored as dates just come out as numbers like 10940720094. Is there some easy way to output them correctly...
here is some of my code..
$db_connection = new COM("ADODB.Connection"
;
$db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=".
realpath("../ceq/CEDatabase.mdb"
." ;DefaultDir=". realpath("../ceq"
;
$db_connection->open($db_connstr);
// make forms to select with
echo "<form method=\"post\" action=\"index.php\"><table><tr><td>Company Name</td><td>".
"<SELECT NAME=\"compName\">";
$rs1 = $db_connection->execute("SELECT [Company Name] FROM Presentation GROUP BY [Company Name]"
;
$rs1_fld0 = $rs1->Fields(0);
while (!$rs1->EOF) {
echo"<OPTION VALUE=\"$rs1_fld0->value\">$rs1_fld0->value";
$rs1->MoveNext();
}
echo"</SELECT></td>";
echo "<td>Commodity</td><td>".
"<SELECT NAME=\"commodity\">";
$rs2 = $db_connection->execute("SELECT [Commodity] FROM Presentation GROUP BY [Commodity]"
;
$rs2_fld0 = $rs2->Fields(0);
while (!$rs2->EOF) {
echo"<OPTION VALUE=\"$rs2_fld0->value\">$rs2_fld0->value";
$rs2->MoveNext();
}
echo"</SELECT></tr></td>";
echo"</table></form>";
// build table based on selections above
$rs = $db_connection->execute("SELECT * FROM Presentation"
;
$rs_fld0 = $rs->Fields(0);
$rs_fld1 = $rs->Fields(1);
$rs_fld2 = $rs->Fields(2);
$rs_fld3 = $rs->Fields(3);
$rs_fld4 = $rs->Fields(4);
$rs_fld5 = $rs->Fields(5);
echo "<table border=1><tr><th>ID</th><th>Company Name</th>".
"<th>Description</th><th>Date Recieved</th><th>Commodity</th><th>Location</th></tr>\n";
while (!$rs->EOF) {
echo "<tr><td nowrap>$rs_fld0->value</td><td nowrap>$rs_fld1->value</td>".
"<td nowrap>$rs_fld2->value</td><td nowrap>$rs_fld3->value</td><td>$rs_fld4->value</td><td nowrap>$rs_fld5->value</td></tr>\n";
$rs->MoveNext(); /* updates fields! */
}
echo "<tr><td colspan=2> </td></tr></table>";
$rs->Close();
$db_connection->Close();
the date received field is a date but it just outputs numbers...
thanks
here is some of my code..
$db_connection = new COM("ADODB.Connection"
$db_connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=".
realpath("../ceq/CEDatabase.mdb"
$db_connection->open($db_connstr);
// make forms to select with
echo "<form method=\"post\" action=\"index.php\"><table><tr><td>Company Name</td><td>".
"<SELECT NAME=\"compName\">";
$rs1 = $db_connection->execute("SELECT [Company Name] FROM Presentation GROUP BY [Company Name]"
$rs1_fld0 = $rs1->Fields(0);
while (!$rs1->EOF) {
echo"<OPTION VALUE=\"$rs1_fld0->value\">$rs1_fld0->value";
$rs1->MoveNext();
}
echo"</SELECT></td>";
echo "<td>Commodity</td><td>".
"<SELECT NAME=\"commodity\">";
$rs2 = $db_connection->execute("SELECT [Commodity] FROM Presentation GROUP BY [Commodity]"
$rs2_fld0 = $rs2->Fields(0);
while (!$rs2->EOF) {
echo"<OPTION VALUE=\"$rs2_fld0->value\">$rs2_fld0->value";
$rs2->MoveNext();
}
echo"</SELECT></tr></td>";
echo"</table></form>";
// build table based on selections above
$rs = $db_connection->execute("SELECT * FROM Presentation"
$rs_fld0 = $rs->Fields(0);
$rs_fld1 = $rs->Fields(1);
$rs_fld2 = $rs->Fields(2);
$rs_fld3 = $rs->Fields(3);
$rs_fld4 = $rs->Fields(4);
$rs_fld5 = $rs->Fields(5);
echo "<table border=1><tr><th>ID</th><th>Company Name</th>".
"<th>Description</th><th>Date Recieved</th><th>Commodity</th><th>Location</th></tr>\n";
while (!$rs->EOF) {
echo "<tr><td nowrap>$rs_fld0->value</td><td nowrap>$rs_fld1->value</td>".
"<td nowrap>$rs_fld2->value</td><td nowrap>$rs_fld3->value</td><td>$rs_fld4->value</td><td nowrap>$rs_fld5->value</td></tr>\n";
$rs->MoveNext(); /* updates fields! */
}
echo "<tr><td colspan=2> </td></tr></table>";
$rs->Close();
$db_connection->Close();
the date received field is a date but it just outputs numbers...
thanks