Help with displaying Date Stored as Integer

Hello folks,

I’m trying to display some dates I have stored in my mysql database as integer. Here’s what I have. I’m getting a black page but if i take off the From_unixtime and just do select from logs_time…the integer shows.

$query=“SELECT FROM_UNIXTIME(log_time) FROM rate_logs LEFT JOIN rate_members ON log_time=m_id LIMIT 1”;
$result=mysql_query ($query);

$num=mysql_numrows($result);

$i=0;
while ($i < $num) {

$field1=mysql_result($result,$i,“log_time”);

echo “$field1
”;

$i++;
}

First of all, mysql_numrows() does not exist as a function :wink: Try mysql_num_rows() instead.

Second, keep in mind that when using FROM_UNIXTIME(), your field is no longer called ‘log_time’. You could of course detect this by using the mysql_field_name() function, but takes a little more knowledge on the subject (but hey, we’re talking challenges here, right? :P)

So, if it doesn’t called log_time what is it called? i’m trying to fix this asap. thanks

Why don’t you just use the ‘AS’ part?

FROM_UNIXTIME(log_time) AS log_time

Got it. Thank you Zyppora

Sponsor our Newsletter | Privacy Policy | Terms of Service