开发者

Set up the right rule get now 500 error

$db->setQuery("UPDATE #__customers (customers_default_address_id) 
           开发者_StackOverflow中文版    SET (customers_default_address_id = address_book_id 
               FROM #__address_book WHERE customers_id = '.(int) $userId.')");

With this rule I get a 500 error. What should be the error?


I think this should solve the problem

$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();


You have an error in your UPDATE syntax:

$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' ");

Also the '.(int) $user_id.' trick doesn't work in my tests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜