Page 1 of 1
inserting some not all values into a row of a database
Posted: Wed Sep 17, 2003 7:37 pm
by Akwebby
I would like to insert 4 values into a database row that has 10+ fields. How might I go about doing this?
Currently I am trying...
"INSERT INTO $user_tablename2 (idnumber, userid, memberpassword, swgname) VALUES(NULL, $user_id, password($user_password), '$swg_name')"
as the query string but i get an sql error message saying that the userid entered in the form is not a recognized field.
Anyone?
Posted: Wed Sep 17, 2003 9:14 pm
by JAM
Code: Select all
"INSERT INTO $user_tablename2 (idnumber, userid, memberpassword, swgname) VALUES('', '$user_id', password('$user_password'), '$swg_name')"
Changed NULL to ''
added some single quotes around $variables
Does that work?
Posted: Thu Sep 18, 2003 3:49 am
by Akwebby
alright now it is kind of working, like the userid and the swgname are set to the correct values but the password is either not passed at all or not set, but it doesn't seem to be in the database at all, and thus my log in pages aren't working and this starts a domino effect, so any ideas on how to get the password to stay?
Posted: Thu Sep 18, 2003 4:05 am
by igoy
before the query... create a new variable and get the value of $user_password in there.
Code: Select all
<?
$upass = $_GET['user_password'];
$myQuery = "INSERT INTO $user_tablename2 (idnumber, userid, memberpassword, swgname) VALUES('', '$user_id', password('$upass'), '$swg_name')"
?>
technically I doesn't make sense since the senario is not changes much.... but I had faced smilar problem once and this is how it was solved.. I couldn't understand why, thus couldn't explain why yuo should do it... but try as you might.
Posted: Thu Sep 18, 2003 9:52 am
by Akwebby
the _GET is not working correctly, it doesn't put anything into the $upass variable
Posted: Thu Sep 18, 2003 10:01 am
by Akwebby
Alright I am not seeing any change whatsoever. I can get values into every other field in the table, but not the password one, even when I go straight in without the password function it doesn't hold. Any suggestions?
Posted: Thu Sep 18, 2003 10:38 am
by Akwebby
Alright i fnially got the password to stick in the table by changing the table definition. Now on my log in page I can't get it to say that the specified pass is correct for the given userid. Any help?