Note: I have a decent understanding of programming basics. I steal most of my code from the web and then adapt it to my use plus reading copious amounts of documentation trying to figure all this out.
Here's the working code:
Code: Select all
// 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)
echo "<td>$cell</td>";
echo "</tr>\n";
}
echo "</table>\n";
mysql_free_result($result);Code: Select all
// 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) {
$pattern='/\d{10}\.\d{6}/';
$timestamp=preg_match($pattern,$cell);
$HRDate=date(n/j/Y h:m:s,$timestamp);
if($HRDate) {
echo "<td>$HRDate</td>";
}else{
echo "<td>$cell</td>";
}
}
echo "</tr>\n";
}
echo "</table>\n";
mysql_free_result($result);I also tried an if for the specific row:
Code: Select all
// 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($row==2) {
$HRDate=date(n/j/Y h:m:s);
echo "<td>$HRDate</td>";
}else{
echo "<td>$cell</td>";
}
}
echo "</tr>\n";
}
echo "</table>\n";
mysql_free_result($result);