I just want to ask. what is the problem in here I just want to add some value to the the columns and get other value to the other table. I hope you can help me. I only have the problem in the first 4 value.
Error: INSERT INTO `orders` (`address`, `payment_method`, `contactnumber`, `order_status`, `cart_id`, `user_id`, `item_id`) VALUES ('Bulacan', '','0912312332', 'Pending' ,(SELECT `cart_id`,`user_id`,`item_id` FROM `cart`)) Operand should contain 1 column(s)
$sql = "INSERT INTO `orders` (`address`, `payment_method`, `contactnumber`, `order_status``cart_id`, `user_id`, `item_id`) VALUES ('$address', '$payment', '$cnumber', '$status'(SELECT `cart_id`,`user_id`,`item_id` FROM `cart`) )";
-Thankyou.
Advertisement
Answer
INSERT INTO `orders` (`address`, `payment_method`, `contactnumber`, `order_status`, `cart_id`, `user_id`, `item_id`) SELECT 'Bulacan', '','0912312332', 'Pending', `cart_id`,`user_id`,`item_id` FROM `cart` WHERE { ??? }