0
希望有人能幫助我解決這個小問題。 我想在我的後端頁面中回顯我的MySQL中的tinyint,看看誰接受了,誰不接受。回覆tinyint在WordPress管理頁面
這是我的代碼:
<?php
ini_set("display_errors", true);
error_reporting(E_ALL);
global $wpdb;
$result2 = $wpdb->get_results("SELECT * FROM ReparationQuotes ORDER BY Id DESC", OBJECT);
?>
<?php foreach ($result2 as $q2) {
//$quote2 = $wpdb->get_results("SELECT Accepted FROM ReparationQuotes Where ReparationId = '" . esc_sql($q2->Id) . "'", OBJECT);
if ($q2->Accepted == 1)
$accepted = "true";
elseif ($q2->Accepted == 0)
$accepted = "false";
}
?>
然後我試圖打電話給變量在我的表
<td class="post-title page-title column title">
<strong> <?php echo $accepted ?> </strong>
</td>
不幸這只是把「假」。沒有找到真正的地方。 它似乎是從MySQL獲取錯誤的值。
如果我將1更改爲0並將0更改爲1,則所有內容均爲「true」。 這裏可能是什麼問題? 謝謝大家的幫忙。