FAO: CoderGoblin - Advice on some code you gave...
Posted: Sat May 19, 2007 9:48 am
Hi, this refers back to a previous post...
viewtopic.php?t=67507
I have a question regarding this code given durnng that last post...
Basically its working, but its missin off part of the date
For example 18-09-2007 is being displayed as 8-09-2007 any ideas why its missing out the 1 (possibly as the 1 is a 10 and it only goes up to 9?
If any one has any ideas please let me know Cheers.
viewtopic.php?t=67507
I have a question regarding this code given durnng that last post...
Code: Select all
<?php
$result = mysql_query("SELECT * FROM databasetablename",$db);
echo "<table>\n";
echo"<tr><td><b>C1</b><td><b>C2</b><td><b>C3</b><td><b>C4</b></tr>\n";
while ($myrow = mysql_fetch_assoc($result))
{
$myrow['datecol']=preg_replace('/([0-9]+)-([0-9]+)-([0-9])+/','$3-$2-$1',$myrow['datecol']);
$myrow['Plays']=($myrow['Plays']==-1 ? 'Yes' : 'No');
echo "<tr><td>{$myrow['col1name']}</td><td>{$myrow['col2name']}</td><td>{$myrow['Plays']}</td><td><{$myrow['datecol']}/td></tr>\n";
}
echo "</table>";
?>Basically its working, but its missin off part of the date
For example 18-09-2007 is being displayed as 8-09-2007 any ideas why its missing out the 1 (possibly as the 1 is a 10 and it only goes up to 9?
If any one has any ideas please let me know Cheers.