3

找到了如何找到 PHP 问题。我现在正试图解决它们,但我对此一无所知。

我使用了 mysql_error ,我发现:

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";

该列存在于订单表中?!

4

1 回答 1

6

在“orders o”之后有一个逗号,这意味着您正在尝试将currency_master表与users表连接起来,而不是ordersand 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"
于 2009-07-19T19:22:44.147 回答