這是問題MySQL的數組字符串轉換錯誤
<?php
include ("Connections/localhost.php");
$result = mysql_query("SELECT COUNT(*) AS total FROM questions LEFT OUTER JOIN answers ON questions.quest_id = answers.ans_question WHERE answers.ans_question IS null;");
$lessons= mysql_fetch_assoc($result);
?>
代碼當我回聲$教訓我得到:
Notice: Array to string conversion in C:\xampp\htdocs\gwishin\dashboard.php on line 21
我知道事情已經改變,因爲我最後一次接觸PHP/MySQL,但我認爲這是正確的或每個查詢現在是一個數組,即使我只能得到一個答案嗎?
'$ lesson [] = mysql_fetch_assoc(result);'該函數返回'array',所以你需要它。 –