View Full Version : New to PHP
Cloud Strife
07-17-2005, 02:37 PM
I'm trying out this code to output all users last post dates. But when I exectue it it doesnt ouput a thing. What am I doing wrong?
<html>
<body>
<?php
require_once('./global.php');
error_reporting(E_ALL & ~E_NOTICE);
$users = $DB_site->query("SELECT * FROM user");
while($user =$DB_site->fetch_array($users)) {
$lastpost = vbdate($dateformat, $user['lastpost']);
echo "$lastpost<br />";
}
?>
</body>
</html>
sabret00the
07-17-2005, 09:23 PM
try echo $lastpost . "<br />";
Adrian Schneider
07-17-2005, 09:30 PM
I think it is becasue $dateformat isn't defined yet (unless it is in vb, but I don't think it is). Try using $vboptions['dateformat'] instead of $dateformat. If you want to display the date and the time the way vB does replace everything inside your while loop with:
$lastpostdate= vbdate($vboptions['dateformat'], $user['lastpost'], true);
$lastposttime= vbdate($vboptions['timeformat'], $user['lastpost']);
echo $lastpostdate . ' ' . $lastposttime . '<br />';
Cloud Strife
07-17-2005, 10:00 PM
I think it is becasue $dateformat isn't defined yet (unless it is in vb, but I don't think it is). Try using $vboptions['dateformat'] instead of $dateformat. If you want to display the date and the time the way vB does replace everything inside your while loop with:
$lastpostdate= vbdate($vboptions['dateformat'], $user['lastpost'], true);
$lastposttime= vbdate($vboptions['timeformat'], $user['lastpost']);
echo $lastpostdate . ' ' . $lastposttime . '<br />';
Thanks alot. Works great now :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.