ShootingBlanks Posted September 5, 2007 Share Posted September 5, 2007 Hello - this may be very easy, but I'm new at PHP... I am building a page that a logged-in user can see their profile info, and then change/update things if they'd like. I have everything pulling in properly, but I am intentionally not pulling in their password (that field comes up blank on their "update profile" screen)... I want it so that if there is something filled into the password field, then the SQL query will update the "pwd" field in the database table (along with the rest of the fields for that record). But, if they leave the password field blank (say, they just want to change their last name or something) then the SQL query will ignore the "pwd" field and only update the rest of the fields in that user's record in the table (thereby keeping the user's password the same as it was before they updated their record)... The password is sha1-encrypted, otherwise I'd just pull the pwd from the database first... I hope I'm making sense and someone can help. Thanks!!! Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2007 Share Posted September 5, 2007 <?php if(isset($_POST['password'])){ //change it }else{ //no change } ?> Quote Link to comment Share on other sites More sharing options...
ShootingBlanks Posted September 5, 2007 Author Share Posted September 5, 2007 Yeah, but can I run two separate UPDATE queries? Like, one for if $_POST['pwd'] is set, and then another if $_POST['pwd'] is NOT set? I didn't know that was allowable. Thanks!... Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2007 Share Posted September 5, 2007 omg, no it's impossible to have more than one line of code. It's even more impossible to append strings or have mysql anywhere near conditional statements. 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.