phpgroupware-developers
[Top][All Lists]
Advanced

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

[Phpgroupware-developers] Help with quotes in sql statements


From: Brian Johnson
Subject: [Phpgroupware-developers] Help with quotes in sql statements
Date: Wed, 13 Nov 2002 20:14:41 +0000

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;





reply via email to

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