我的目標是減去兩次,然後從那裏生成一個登錄檢查器。這段代碼爲什麼會產生空白?
我需要知道的是,如果我已經在幾分鐘內正確減去了兩次。
PHP版本:7.0
時間是使用NOW輸入到DB(),並顯示如(實施例:2016年7月23日15時01分34秒)
出於某種原因,其中,該代碼包含在HTML中,只是空白。
代碼(一切都在代碼中定義的上漲):
<?php
include ('../includes/connection.php');
include ('../scripts/functions.php');
$getOnlineAdmins = $handler->prepare('SELECT * FROM Admins WHERE AdminLevel >= :al AND Status= :stat');
$statn = 1;
$aln = 1;
$getOnlineAdmins->bindParam(':al', $aln);
$getOnlineAdmins->bindParam(':stat', $statn);
$getOnlineAdmins->execute();
echo "
<table class='table-fill'>
<thead>
<tr>
<th class='text-left' style='padding-left: 12px; padding-right: 12px;';></th>
</tr>
</thead>
<tbody class='table-hover'>";
if ($getOnlineAdmins->rowCount() >=1){
echo ("These is one or more rows.");
while ($results = $getOnlineAdmins->fetch()){
if((strtotime($results['LastVisited']) + 900) >= time()){
echo ("Time requirement met.");
switch ($results['AdminLevel']) {
case 3:
$rank = 'In-Training/Intern';
break;
case 6:
$rank = 'Community Moderator';
break;
case 9:
$rank = 'Senior Moderator';
break;
case 12:
$rank = 'Supervisor';
break;
case 15:
$rank = 'Administrator';
break;
case 18:
$rank = 'Senior Administrator';
break;
case 21:
$rank = 'Staff Advisor';
break;
case 24:
$rank = 'Engineer';
break;
case 27:
$rank = 'Vice Chairman';
break;
case 30:
$rank = 'Chairman';
break;
case 33:
$rank = 'Website Engineer';
break;
default:
$rank = 'Unknown';
break;
}
echo "<tr>";
echo "<td>" . $results['Username'] . " - " . $rank . "</td>";
} else {
echo "<tr><td>{$results['Username']} – $rank</td>";
}
}
}else{
echo "<tr><td>There are no staff members online.</td>";
}
echo " </tbody>
</table>";
?>
當你運行它會發生什麼?你會得到預期的結果嗎? –
我沒有得到預期的結果。這是代碼,也許我有一個不同的錯誤? http://pastebin.com/Abx176F2 – Austin
我看到許多明顯的錯誤。這段代碼來自哪裏? –