phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] Help with quotes in sql statements


From: Brian Johnson
Subject: Re: [Phpgroupware-developers] Help with quotes in sql statements
Date: Thu, 14 Nov 2002 19:24:45 +0000

I wondered where this message went to - I sent the email two days ago

Anyway - I found the problem and fixed it using the addslashes function



Brian Johnson (address@hidden) wrote*:
>
>Could someone help me with to change this sql statement from the addbook 
>module, it
>has problems with names that include a single quote (like O'Sullivan)
>
>$sql = 'UPDATE phpgw_addbook_person_main SET ';
>$sql.= 'title = \''.$person['main']['title'].'\', ';
>$sql.= 'last_name = \''.$person['main']['last_name'].'\', ';
>$sql.= 'middle = \''.$person['main']['middle'].'\',';
>$sql.= 'first_name = \''.$person['main']['first_name'].'\', ';
>$sql.= 'birthday = \''.$birthday.'\', ';
>$sql.= 'gender = \''.$person['main']['gender'].'\'';
>$sql.= ' WHERE id = '.$id;
>
>This doesn't work
>
>$sql = "UPDATE phpgw_addbook_person_main SET ";
>$sql.= "title = \"".$person['main']['title']."\", ";
>$sql.= "last_name = \"".$person['main']['last_name']."\", ";
>$sql.= "middle = \"".$person['main']['middle']."\",";
>$sql.= "first_name = \"".$person['main']['first_name']."\", ";
>$sql.= "birthday = \"".$birthday."\", ";
>$sql.= "gender = \"".$person['main']['gender']."\"";
>$sql.= " WHERE id = ".$id;
>
>
>
>_______________________________________________
>Phpgroupware-developers mailing list
>address@hidden
>http://mail.gnu.org/mailman/listinfo/phpgroupware-developers
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]