INSERT query help....
Posted: Sun Aug 18, 2002 4:10 pm
I've been making a control panel for my web site to make it really easy to update, and on one database(this page is for a lan party website) it tells whether people have payed or not. its Table registered, with the column payed, and payed either = "Y" or it = "" now this one thing I've been trying to do is to basically insert Y into the "" but only for a certain person. I have each person sorted using usernumber(an auto_increment value)..
heres the code.. I've been working on this for a while.. cant figure out what I'm doing wrong..
now $namenumber was from the previous confirmation page(confirming you want to select that person.. basically a stored variable, I was trying to give a simpler name)
so basically what I wanted it to do, is.. insert into table registered only in the row where the usernumber I have selected is present, then modify column payed, by inserting value Y..... anything wrong with that you can see?.... any questions, ask, and I'll answer.. thanx for helping
edit : forgot to post the error it gave.. here it is
You have an error in your SQL syntax near 'WHERE usernumber = ( payed ) VALUES ('Y') ' at line 1 INSERT INTO registered WHERE usernumber = ( payed ) VALUES ('Y')
heres the code.. I've been working on this for a while.. cant figure out what I'm doing wrong..
Code: Select all
$value = "Y";
# setup SQL statement
$SQL = " INSERT INTO registered WHERE usernumber = $namenumber ";
$SQL = $SQL . " ( payed ) VALUES ";
$SQL = $SQL . " ('$value') ";so basically what I wanted it to do, is.. insert into table registered only in the row where the usernumber I have selected is present, then modify column payed, by inserting value Y..... anything wrong with that you can see?.... any questions, ask, and I'll answer.. thanx for helping
edit : forgot to post the error it gave.. here it is
You have an error in your SQL syntax near 'WHERE usernumber = ( payed ) VALUES ('Y') ' at line 1 INSERT INTO registered WHERE usernumber = ( payed ) VALUES ('Y')