+ 15
Vepa Orazov Hey, you don't need where clause at all. INSERT INTO items VALUES ('The' , 'Thing', 1, 2, 'img.png')
28th Jan 2019, 8:41 AM
r8w9
r8w9 - avatar
+ 4
r8w9 is right. INSERT INTO does not come with WHERE field. If you need to update existng record, you should use UPDATE. UPDATE items SET `title`=?, `text`=?, `image`=? WHERE `user_id`=? AND `category_id`=? If you use PDO, You need to use prepare and bindvalue to bing the user id and category id before execute it.
28th Jan 2019, 9:44 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 3
Really, why you need where clause there? As I know INSERT ... VALUES.. doesn't go with where, if you want to filter out some values you can do it differently for ie: If (condition) INSERT... VALUES...
8th Mar 2019, 1:02 AM
Dejan Dozet
Dejan Dozet - avatar