Re: [PHP-DB] Not updating certain fields in same row

[email protected] (Jason Pruim)
Newsgroups php.db
Message-ID <[email protected]>
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
> [email protected]
>
>
>

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.