Reputation: 3107
This part of code :
INSERT INTO koszyk_produkt (ID_koszyk,ID_produkt,Ilosc)
VALUES (
(SELECT ID FROM koszyk
WHERE ID_klient=IDk),
IDp,Ilosc);
works perfectly fine when tested in HeidiSQL (MariaDB), but fails with two errors when I try to apply this in phpMyAdmin (the same engine):
A comma or a closing bracket was expected (near SELECT)
Unexpected token. (near ID)
I'm lack of ideas how to make this work.
@EDIT
I forgot to add - this is procedure, and IDk IDp Ilosc are arguments.
Upvotes: 1
Views: 305
Reputation: 13949
You can select the ID and use the arguments as the 2nd and 3rd columns.
INSERT INTO koszyk_produkt
(ID_koszyk,ID_produkt,Ilosc)
SELECT ID,
IDp,
Ilosc
FROM koszyk
WHERE ID_klient = IDk
Upvotes: 2