i am trying to acquire unix_timestamp value for a particular timestam开发者_Go百科p column. but i am confused.
$timecheck = mysql_query("SELECT UNIX_TIMESTAMP(datetime) FROM machine where m_id = $m_id");
if (mysql_num_rows($timecheck) > 0){
while ($timefetch = mysql_fetch_object($timecheck)) {
echo $timefetch->datetime;
print_r($timefetch[0]->datetime);
if (($timefetch->datetime - time()) > 6000){
echo "1";
}
else {
echo "0";
}
}
the timestamp value returned is an stdClass object. cannot use it to compare. can someone please help me with the below code
Use an alias for column name in your SQL query:
SELECT UNIX_TIMESTAMP(datetime) AS datetime FROM machine where m_id = $m_id
精彩评论