INSERT INTO `orders_product` (order_id,product_id,num) VALUES (SELECT 1, product_id, num FROM `cart` WHERE user_id=1)
Kod
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 2, product_id, num FROM `cart` WHERE user_id='1')' at line 1
Podzapytanie "SELECT..." spomiędzy nawiasów działa prawidłowo. Pokazuje 3 kolumny int. Tabela do której chce wrzucić dane wygląda tak :
CREATE TABLE IF NOT EXISTS `orders_product` ( `id` int NOT NULL AUTO_INCREMENT, `order_id` int NOT NULL, `product_id` int NOT NULL, `num` int NOT NULL, PRIMARY KEY (`id`) ) (...);
W czym leży problem ?
