-1
我在mysqli的真小白,所以我需要幫助..mysqli的LEFT JOIN計數
請幫我轉換這個MySQL到mysqli的 ...我不出來..
$new_mail = mysql_result(
mysql_query(
"SELECT COUNT(*) FROM `mail`
LEFT JOIN `contact` ON `mail`.`user_id` = `contact`.`from_id`
AND `contact`.`user_id` = '$user_id
WHERE `mail`.`from_id` = '$user_id'
AND `mail`.`read` = '0'
AND `mail`.`delete` != '$user_id'
AND `contact`.`ban` != '1'")
, 0);
if ($new_mail)
$list[] = '<a href="link">Message - $new_mail </a>'
查詢不變,請學習_SQL injection_。使用預準備的語句PDO和MySQLi都有它們。 – Rudie