1969?! ... huh?

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

PHP Code: [ Select ]
 
<?PHP
 
$db_username = "hehe";
 
$db_password = "youaintseeingthissorry";
 
$db_hostname = "localhost";    
 
$db_connect = mysql_connect($db_hostname, $db_username, $db_password)or die("Unable to connect to MySQL");
 
$db_select = mysql_select_db("gmforum", $db_connect)or die("Unable to select test");
 
 
 
$result = mysql_query("SELECT UNIX_TIMESTAMP(lastvisit) as lastvisit FROM gs_admin");
 
 
 
echo date("F jS Y h:i:s", $result['lastvisit'])
 
?>
  1.  
  2. <?PHP
  3.  
  4. $db_username = "hehe";
  5.  
  6. $db_password = "youaintseeingthissorry";
  7.  
  8. $db_hostname = "localhost";    
  9.  
  10. $db_connect = mysql_connect($db_hostname, $db_username, $db_password)or die("Unable to connect to MySQL");
  11.  
  12. $db_select = mysql_select_db("gmforum", $db_connect)or die("Unable to select test");
  13.  
  14.  
  15.  
  16. $result = mysql_query("SELECT UNIX_TIMESTAMP(lastvisit) as lastvisit FROM gs_admin");
  17.  
  18.  
  19.  
  20. echo date("F jS Y h:i:s", $result['lastvisit'])
  21.  
  22. ?>


ok timestamped, got it from the mysql blah blah and oh my .....

http://dhost.info/gmforum/test.php

December 31st 1969 07:00:00

?!
  • this213
  • Guru
  • Guru
  • User avatar
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

Guessing that you actually have a field called UNIX_TIMESTAMP(lastvisit) in your db, you should be doing something like this:
PHP Code: [ Select ]
$db_username = "hehe";
 
$db_password = "youaintseeingthissorry";
 
$db_hostname = "localhost";    
 
$db_connect = mysql_connect($db_hostname, $db_username, $db_password)or die("Unable to connect to MySQL");
 
$db_select = mysql_select_db("gmforum", $db_connect)or die("Unable to select test");
 
 
 
$result = mysql_query("SELECT UNIX_TIMESTAMP(lastvisit) FROM gs_admin",$db_connect);
 
$row = mysql_fetch_array($result);
 
$lastvisit = $row[0];
 
 
 
echo date("F jS Y h:i:s", $lastvisit);
  1. $db_username = "hehe";
  2.  
  3. $db_password = "youaintseeingthissorry";
  4.  
  5. $db_hostname = "localhost";    
  6.  
  7. $db_connect = mysql_connect($db_hostname, $db_username, $db_password)or die("Unable to connect to MySQL");
  8.  
  9. $db_select = mysql_select_db("gmforum", $db_connect)or die("Unable to select test");
  10.  
  11.  
  12.  
  13. $result = mysql_query("SELECT UNIX_TIMESTAMP(lastvisit) FROM gs_admin",$db_connect);
  14.  
  15. $row = mysql_fetch_array($result);
  16.  
  17. $lastvisit = $row[0];
  18.  
  19.  
  20.  
  21. echo date("F jS Y h:i:s", $lastvisit);


Any time the date function returns a date of December 31st 1969 7AM, the number you supply (as $lastvisit here) either really evaluates to that date or it couldn't understand what you were trying to say.
  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

I fixed it ages ago :)

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.