對於我的sql查詢,我有下面的錯誤。我一直在絞盡腦汁,似乎無法弄清楚。任何幫助表示讚賞。INNER JOIN語句上的SQL錯誤
Error:
08-07-2013, 19:05:55: Database access error. Please contact the site administrator. SELECT * FROM realty_auctions WHERE id = 42962 INNER JOIN realty_agents ON realty_auctions.agentsid=realty_agents.agentsid; 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 'INNER JOIN realty_agents ON realty_auctions.agentsid=realty_agents.age' at line 3 page:/home/propoint/public_html/item.php line:567
SQL查詢:
// get agent data
$query = "SELECT * FROM " realty_auctions WHERE id = " . $id ." INNER JOIN realty_agents ON " realty_auctions.agentsid=realty_agents.agentsid; ";
$result = mysql_query($query);
$system->check_mysql($result, $query, __LINE__, __FILE__);
$agent_data = mysql_fetch_assoc($result);
echo $agent_data;
您是否犯了複製錯誤?您的引用使得無效的PHP語法, – Barmar
不,這正是我的代碼。我很新,這是我嘗試創建的第一個完整功能。 – NUGGET
你沒有從PHP獲得解析錯誤? 'realty_auctions WHERE id ='應該在雙引號字符串中。 – Barmar