我有關於這3個查詢一個問題:致命的問題查詢
select count(*) as rec_count from test_history inner join
test_detail on test_history.history_id = test_detail.test_history_id
where test_history.history_id in ({$_SESSION['history_ids']})
and test_history.user_id = $userID
和
select count(*) as correct_answers from test_history inner join test_detail
on test_history.history_id = test_detail.test_history_id
where test_history.history_id in ({$_SESSION['history_ids']}) and
test_history.user_id = $userID and is_correct = 1
而這一次
select * from test_topics inner join
test_topics_link on test_topics.`topic_id` = test_topics_link.`topic_id`
where test_topics_link.test_id in ({$_SESSION['ids_tests']}) and percentage > 0
我一直都想與此錯誤:
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ') and
test_history.user_id = 82' at line 3
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ') and
test_history.user_id = 82 and is_correct = 1' at line 2
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ')' at line 1
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ') and percentage > 0' at
line 3
什麼值{$ _SESSION ['history_ids']}?確保這個擴展爲一個合理的值 – wonk0
顯示爲php代碼。 + var_dump($ _ SESSION ['ids_tests'],$ _SESSION ['history_ids']) – Subdigger
是的它有正確的值它有正常的用戶ID 82 – Marco