English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm writing a database application for the web using php and mysql. Right now I'm working on the portion of the code that will allow the administrator to authorize someone who is attempting to register to use the database. Here's the mysql query that is giving me fits:
mysql_query("replace(authorized, '0', '1') from members where id = $_POST[sel_id]") or die(mysql_error());

What the code is attempting to do is changed the boolean field authorized from 0 to 1 for any records in the members table where their id matches the one passed in from the submission form as sel_id. But, when I attempt to authorize, I get the following mysql_error:
You have an error in your SQL syntax near '(authorized, '0', '1') from members where id = 10' at line 1
Can anyone give me a hand in figuring out what I'm doing wrong? This is my first attempt at using the "replace" function so I've probably got the syntax wrong or something but I can't seem to find help on it anywhere. Thanks.

2006-12-03 05:54:40 · 1 answers · asked by Chris S 5 in Computers & Internet Programming & Design

1 answers

Try:
UPDATE members
SET authorize = 1
WHERE id = $_POST[sel_id]

2006-12-03 06:07:04 · answer #1 · answered by Anissa T 2 · 2 0

fedest.com, questions and answers