$db->setQuery("UPDATE #__customers (customers_default_address_id)
SET (customers_default_address_id = address_book_id
FROM #__address_book WHERE customers_id = '.(int) $userId.')");
使用这个规则,我得到一个500的错误。误差应该是多少?
我想这应该能解决问题
$address_id = tep_db_insert_id();
$db->setQuery(" UPDATE #_customers
SET customers_default_address_id = '" . (int)$address_id . "'
where customers_id = '" . (int) $userId . "'");
$db->query();
您的UPDATE
语法错误:
$user_id = mysql_real_escape_string($user_id);
$db->setQuery("UPDATE customers c
INNER JOIN address_book ab ON (...join-criterion_here...)
SET c.customers_default_address_id = ab.address_book_id
WHERE c.customers_id = '$user_id' ");
另外,'.(int) $user_id.'
技巧在我的测试中不起作用