找到了如何发现php问题。我现在正试图解决这些问题,但我对这件事一无所知。
我利用mysql_错误发现:
1054: Unknown column 'o.user_id' in 'on clause'
有什么问题吗:
$sql="SELECT o.*, u.user_name, u.email, od.artist_id,cm.nexchange_price
FROM ".$tableprefix."orders o,".$tableprefix."currency_master cm
INNER JOIN ".$tableprefix."users u ON o.user_id = u.user_id
INNER JOIN ".$tableprefix."order_details od ON o.order_id = od.order_id
WHERE o.order_id = ".GetSQLValueString($orderid,"text")."
AND o.vorder_currency = cm.vcurrency_code ".$qryopt . " ORDER BY o.order_date DESC";
订单表中存在该列?!
最佳答案
“orders o”后面有一个逗号,这意味着您试图将currency_master
表与users
表连接起来,而不是将orders
和users
表连接起来。我想你想要:
$sql="
SELECT
o.*, u.user_name, u.email, od.artist_id,cm.nexchange_price
FROM
".$tableprefix."currency_master cm,
".$tableprefix."orders o
INNER JOIN
".$tableprefix."users u
ON
o.user_id = u.user_id // et cetera"
关于php - 存在未知列的MySQL警告,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1150637/