Hey Guys,
Need a bit of help with a problem pulling data from a mysql database. I have timestamps stored in an integer field in mysql. I am pulling those rows out in a foreach statement, and I need to run the date function to output that timestamp in a human readable format in a table. When I pull that field with the rest of the row it is entered into the array as a string. I have tried the normal ways (intvar, (int)) to convert this to an integer to be used in the date command and none seem to do so properly. How can I go about converting that string into a proper integer without changing the timestamp?
Basic jist of what I am trying to do:
$sql = ("SELECT * FROM database WHERE field = '" . $variable . "';");
$result = mysql_query($sql);
foreach (mysql_fetch_assoc($result) as $row)
{
echo(date('format string', $row["timestamp"]));
}