Time help

vRory

Unemployed.
May 4, 2011
447
69
PHP:
<?php
                       
                        function Minutes($time)
                        {
                            $ret = "";
                           
                            $minutes = ($time);
                            if($minutes > 0)
                                $ret .= "$minutes Minutes";
 
                            return $ret;
                        }
                        ?>


I'm no good at time on php, how do i change this so it shows days instead of minuets...
 

vRory

Unemployed.
May 4, 2011
447
69
PHP:
<?php
 
                        function Minutes($time)
                        {
                            $ret = "";
                           
                            $minutes = ($time);
                            if($minutes > 0)
                                $ret .= "$minutes Minutes";
 
                            return $ret;
                        }
                        ?>
                        <div class="cbb clearfix blue ">
                            <h2 class="title">Saddest Users</h2>
                            <div style="padding:5px">
                                <table style="width: 100%">
                                    <?php
                                   
                                    $getTimeOnline = mysql_query("SELECT * FROM `user_stats` WHERE `OnlineTime` >= '0' ORDER BY `OnlineTime` DESC LIMIT 5");
                                    while(($TimeOn = mysql_fetch_array($getTimeOnline))) {
 
                                    $getUserInfo = mysql_query("SELECT * FROM `users` WHERE `id` = '".$TimeOn['id']."'");
                                    $userInfo = mysql_fetch_array($getUserInfo);
                                   
                                    echo '
                                    <tr>
                                        <td width="20%"><img src="http://habbo.nl/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=s" /></td>
                                        <td width="80%"><b><a href="/home">'.$userInfo['username'].'</a></b><br />'.Minutes($TimeOn['OnlineTime']).' Spent Online</td>
                                    </tr>';
                                    }
                                    ?>
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
I don't get why someone is actually using a function for that, but allright. I'm not sure what that query outputs, so can you echo $TimeOn['OnlineTime'] and say what it outputted? Or you can look in the database for the OnlineTime column and get one of those values.
 

Users who are viewing this thread

Top