"INSERT INTO a ('b') values ('c') where id = e" do

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
divx
Forum Newbie
Posts: 20
Joined: Sun Jul 01, 2007 1:37 pm

"INSERT INTO a ('b') values ('c') where id = e" do

Post by divx »

connected to database

"INSERT INTO a ('b') values ('c') where id = e"

a = table name

why doesnt the above work?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Why would you INSERT to a row that exists? You need UPDATE ;)
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

d11wtq wrote:Why would you INSERT to a row that exists? You need UPDATE ;)
Or REPLACE and instead of using a WHERE clause, just set id.
ody
Forum Contributor
Posts: 147
Joined: Sat Mar 27, 2004 4:42 am
Location: ManchesterUK

Post by ody »

Problems:

1. You have quotes around the column name, use back ticks instead.
2. Your INSERT has a WHERE clause.
Post Reply