-4
UPDATE  p.id_product, p.quantity, p.price,p.on_sale, p.additional_shipping_cost, p.active,
                        p.available_for_order, p.show_price, p.date_upd,
                        pl.id_product, pl.name,pl.description, pl.description_short,
                        cl.id_category, cl.name,
                        ps.is_product,ps.price
                    LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
                    LEFT JOIN ps_category_lang cl ON (p.id_category_default = cl.id_category)
                    LEFT JOIN ps_product_shop ps ON (p.id_category_default = ps.id_product)

                SET     
                        p.quantity = \"$quantity\", 
                        p.price = \"$price\", 
                        p.additional_shipping_cost = \"$additional_shipping_cost\",
                        p.active = \"$active\", 
                        p.available_for_order = \"$available_for_order\", 
                        p.show_price = \"$show_price\",
                        pl.name=\"$name\", 
                        pl.description=\"$description\",
                        pl.description_short=\"$description_short\",
                        p.date_upd = NOW(),
                        cs.price=\"$price\", 
                        cs.date_upd = NOW() 
                WHERE p.id_product = $i
4

1 回答 1

0

the correct syntax of the update statement is

update FooTable 
 set fooField1 = fooValue
where foofield2 = fooCondition

so, your query must look like something like this, with no selection of the fields...

UPDATE  FooTable p
                    LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
                    LEFT JOIN ps_category_lang cl ON (p.id_category_default = cl.id_category)
                    LEFT JOIN ps_product_shop ps ON (p.id_category_default = ps.id_product)

                SET     
                        p.quantity = \"$quantity\", 
                        p.price = \"$price\", 
                        p.additional_shipping_cost = \"$additional_shipping_cost\",
                        p.active = \"$active\", 
                        p.available_for_order = \"$available_for_order\", 
                        p.show_price = \"$show_price\",
                        pl.name=\"$name\", 
                        pl.description=\"$description\",
                        pl.description_short=\"$description_short\",
                        p.date_upd = NOW(),
                        cs.price=\"$price\", 
                        cs.date_upd = NOW() 
                WHERE p.id_product = $i
于 2013-07-02T12:09:32.610 回答