Not updating certain fields in same row

From: Date: Tue, 25 Mar 2008 16:59:23 +0000
Subject: Not updating certain fields in same row
Groups: php.db 
Request: Send a blank email to php-db+get-44777@lists.php.net to get a copy of this message
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

« previous php.db (#44777) next »