Hello!
I'm very new to PHP and MySQL and I have managed to construct some PHP code to extract all records from a table and display them. The only hurdle is the "datetime" fields. This is waht I have so far:
This checks to see if the field is empty and substitutes "na" ($noentry variable) if it is but I would also like to check if the field is a "date" and convert it to DD/MM/YYYY if it is.
Any thoughts or suggestions would be greatly appreciated.
Thanks!
I'm very new to PHP and MySQL and I have managed to construct some PHP code to extract all records from a table and display them. The only hurdle is the "datetime" fields. This is waht I have so far:
Code:
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
if ($cell==NULL) {
echo "<td nowrap='nowrap'><font face='Verdana'><font size='1'>$noentry</font></td>";
} else {
echo "<td nowrap='nowrap'><font face='Verdana'><font size='1'>$cell</font></td>";
}
echo "</tr>\n";
}
This checks to see if the field is empty and substitutes "na" ($noentry variable) if it is but I would also like to check if the field is a "date" and convert it to DD/MM/YYYY if it is.
Any thoughts or suggestions would be greatly appreciated.
Thanks!