Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL] INSERT + SELECT
peter13135
post
Post #1





Grupa: Zarejestrowani
Postów: 1 447
Pomógł: 191
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


  1. 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 :

  1. CREATE TABLE IF NOT EXISTS `orders_product` (
  2. `id` int NOT NULL AUTO_INCREMENT,
  3. `order_id` int NOT NULL,
  4. `product_id` int NOT NULL,
  5. `num` int NOT NULL,
  6. PRIMARY KEY (`id`)
  7. ) (...);



W czym leży problem ? (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 17:50