0

我正在创建一个帐户页面,人们可以在其中看到他们的“硬币”,这是我当前正在创建的网站上的货币。我已经设置了数据库和表,它只是没有显示。

以下是存储在 admin 中的表格:id、用户名、密码、电子邮件、横幅、硬币、管理员、图片、状态、描述和推特。

<?php
session_start();
include('global.php');
$getNotification = mysql_query("SELECT * FROM stage") or die(mysql_error());
$getStats = mysql_query("SELECT * FROM admin") or die(mysql_error());
$note= mysql_query("SELECT * FROM notifications ORDER BY id DESC LIMIT 5") or die(mysql_error());
$result = mysql_query("SELECT * FROM admin WHERE username='$login_session'");


$admin = $row['admin'];

while($row = mysql_fetch_array( $result )) {
   $coins= $row['coins'];
//if (($row['ipbanned']=="1"))
//{
//header("location: ipbanned.php");
//}
//}
}

if (($session_username))
{

}
else
{
header("location: index.php");
}

$off = mysql_query("SELECT * FROM siteoffline WHERE site='http://intervention.hostei.com/'");
if (($row['offline']=="1"))
{
header("location: underdev.php");
}


?>
<html>


<head>

    <title>Intervention</title>
    <link rel="stylesheet" type="text/css" href="/style.css">

<head>

</head>


<body>

    <?php include('./include/logonav.php') ?>

    <div id="content">

      <div id="account">

         <center><font size="5" width="100%"><?php echo $session_username; ?>'s Home</font></center>

         <font id="avatar">
            IMAGE HERE C:
         </font>
         <font id="notitications">
            <center>
               <u><b>Notifications</b></u>
                           <?
while($ra = mysql_fetch_array( $note )) {
echo '<div id="bn" style="width:220px; display:block;">';
echo nl2br($ra['body']);
echo '<br><br>Posted by: ';
echo $ra['name'];
echo '<br>';
$time = time();
$get_time = $ra['date'];
$diff = $time - $get_time;


   switch(1)
      {
         case ($diff < 60):
         $count = $diff;
         if ($count==0)
            $count = "A moment";
         else if ($count==1)
            $suffix = "second";
         else
            $suffix = "seconds";
         break;

         case ($diff > 60 && $diff < 3600):
         $count = floor($diff/60);
         if ($count==1)
            $suffix = "minute";
         else
            $suffix = "minutes";
         break;

         case ($diff > 3600 && $diff < 86400):
         $count = floor($diff/3600);
         if ($count==1)
            $suffix = "hour";
         else
            $suffix = "hours";
         break;

         case ($diff > 86400 && $diff < 604800):
         $count = floor($diff/86400);
         if ($count==1)
            $suffix = "day";
         else
            $suffix = "days";
         break;

         case ($diff > 604800 && $diff < 2629743):
         $count = floor($diff/604800);
         if ($count==1)
            $suffix = "week";
         else
            $suffix = "weeks";
         break;

         case ($diff > 2629743 && $diff < 31556926):
         $count = floor($diff/2629743);
         if ($count==1)
            $suffix = "month";
         else
            $suffix = "months";
         break;

         case ($diff > 31556926):
         $count = floor($diff/31556926);
         if ($count==1)
            $suffix = "year";
         else
            $suffix = "years";
         break;

      }
         echo "".$count." ".$suffix." ago";
}
?>
            </center>
         </font>
         <font id="statistics">
            <center>
               <u><b>Statistics</b></u>
               <br />
               Coins: 
               <?
               while($rap = mysql_fetch_array( $getStats )) {
               echo " ";
            }
                ?>

            </center>
         </font>
         <font id="badges">
            <center><u><b>Badges</b></u></center>
         </font>


      </div>


    </div>

    <?php include('./include/footer.php') ?>

</body>


</html> 
4

1 回答 1

0

你是说硬币没有显示..

这里`

 <font id="statistics">
            <center>
               <u><b>Statistics</b></u>
               <br />
               Coins: 
               <?
               while($rap = mysql_fetch_array( $getStats )) {
               echo " ";
            }
                ?>

            </center>
         </font>`

您只回显空字符串: echo " "; 同时从 $rap 变量中放一些东西

print_r($rap);
于 2012-09-09T14:46:47.193 回答