aktell Posted February 10, 2007 Share Posted February 10, 2007 Hi there, The ERROR Msg is always around SELECT: (.. right syntax to use near 'SELECT member_id FROM ....)' at line 2) <? //********** I have the member_id included as the ONLY given value in the DB. if ((!$_POST[member_id]) || (!$_POST[f_name]) || (!$_POST[l_name]) || (!$_POST[username]) || (!$_POST[password])) { header("Location: show_adduser.htm"); exit; } //********** code to connect etc. //********** //********** My real problem here is HOW to state the query ??? I assume that I have a bracket or comma etc. to much ???. $sql = "INSERT INTO $table_name (f_name, l_name, username, password) VALUES ('$_POST[f_name]', '$_POST[l_name]', '$_POST[username]', password('$_POST[password]'), SELECT member_id = '$_POST[member_id]' FROM $table_name)"; //********** //********** OR ?? $sql = "INSERT INTO $table_name (f_name, l_name, username, password) VALUES ('$_POST[f_name]', '$_POST[l_name]', '$_POST[username]', password('$_POST[password]'), SELECT member_id FROM $table_name WHERE member_id LIKE member_id = '$_POST[member_id]')"; ?> Thanks for any help in advance aktell ??? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 10, 2007 Share Posted February 10, 2007 Array keys must be strings, like this: $_POST['f_name'] What are you trying to do? You run an insert then a select - are you just trying to get the ID of the inserted member? use mysql_insert_id(); Either way the two statements should be seperated. Quote Link to comment Share on other sites More sharing options...
aktell Posted February 11, 2007 Author Share Posted February 11, 2007 Array keys must be strings, like this: $_POST['f_name'] What are you trying to do? You run an insert then a select - are you just trying to get the ID of the inserted member? use mysql_insert_id(); Either way the two statements should be seperated. Hi there, I'm trying to INSERT certain values as f_name etc. INTO a record which already has a given ID number (member_id) aktell Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2007 Share Posted February 11, 2007 That's called an Update. If the record already exists, you update it. Quote Link to comment Share on other sites More sharing options...
aktell Posted February 11, 2007 Author Share Posted February 11, 2007 That's called an Update. If the record already exists, you update it. Well, I'm feeling pretty foolish here. Sorry, I ndid not think out of the INSERT. $sql = "UPDATE $table_name SET f_name = '$_POST[f_name]', l_name = '$_POST[l_name]', username = '$_POST[username]', password = password('$_POST[password]') WHERE member_id = '$_POST[member_id]'"; It worked strait away. Thanks alot !!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.