PDA

View Full Version : How To Need help with vb:raw



xecvantec
12-18-2011, 09:00 PM
I've added 2 field in table user: money and time.
id money time
1 200 0
2 600 1395978200

I also show information money with {vb:raw bbuserinfo.money}.
But with time i want to show ( (time - time() ) / 86400) ) to calculate days remaining.
And how do i to show it?

dotancohen
01-10-2012, 05:44 AM
Hi. You need to get the two time values, then subtract them as I am sure that you know. This is how to get all the time values from your database, it should be enough for you to figure out how to do what you need:


$sql = "SELECT time FROM user WHERE userid = ".$userID;
$results = $vbulletin->db->query_read($sql);
while ( $row = $vbulletin->db->fetch_array($results) ) {
echo $row['time']."<br />";
}