Re: Not updating certain fields in same row
| From: | Jason Pruim | Date: | Thu, 27 Mar 2008 16:30:56 +0000 |
| Subject: | Re: Not updating certain fields in same row | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44835@lists.php.net to get a copy of this message | ||
Hi Everyone
Thanks for all the info and help with this, I have decided to write a separate function for changing the password. That way I can compare the original password with the one inputted in the database, and then change it after both have been the old and new password have been verified :)
So Thanks! :)
On Mar 25, 2008, at 12:59 PM, Jason Pruim wrote:
Hi everyone, I am attempting to update a record for a login system while leaving certain fields untouched if they arn't changed, and am running into issues. Basically what I want to do, is say I have these fields: Field1 Field2 Field3 Field4 I update Field1 and Field3 but not Field2 and Field4. What I want to do is change the values in Field1 and Field3 without touching the values in Field2 and Field4. I have tried this code: $tab = "\t"; if (!isset($_POST['txtLoginName']) || empty($_POST['txtLoginName'])) { $loginName = mysqli_real_escape_string($chpwpostlink, $_POST['txtLoginName']); } else { $loginName = $tab; } which works the fields that I've changed, but if I don't submit a value in the form it sets the field to be blank in MySQL. Which is what I am trying to avoid. Any ideas? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com japruim@raoset.com-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com japruim@raoset.com