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!!! Link to comment https://forums.phpfreaks.com/topic/68119-only-submitting-password-update-if-filled-in/ 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 } ?> Link to comment https://forums.phpfreaks.com/topic/68119-only-submitting-password-update-if-filled-in/#findComment-342402 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!... Link to comment https://forums.phpfreaks.com/topic/68119-only-submitting-password-update-if-filled-in/#findComment-342410 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. Link to comment https://forums.phpfreaks.com/topic/68119-only-submitting-password-update-if-filled-in/#findComment-342413 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.