如果數據庫中的cDeviceRegistrationId列有值,我試圖打印出「1」。下面是代碼:
$結果是一個SQL查詢
while($row = mysql_fetch_assoc($result))
{
if ($row['cDeviceRegistrationId'] > 0) {
$a = 1;
}
echo "<tr class='forum'>";
echo "<td class='forum'>" . $row['intUserID'] . "</td>";
echo "<td class='forum'>" . $row['cUsername'] . "</td>";
echo "<td class='forum'>" . $row['cEmail'] . "</td>";
echo "<td class='forum'>$a</td>";
echo "<td class='forum'>" . $row['uCreateDate'] . "</td>";
echo "</tr>";
}
代替> 0,你怎麼插上,IS NULL? – BigMike 2011-04-26 23:49:13
@BigMike:如果列上的IS NULL爲真,我相信MySQL會返回一個字符串值「1」,所以試試:== == 1「' – 2011-04-27 10:35:31