DB : inserting text with embedded "

From: Date: Tue, 09 Jan 2001 09:33:00 +0000
Subject: DB : inserting text with embedded "
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-884@lists.php.net to get a copy of this message
Hi all, This may be a silly question...but I am trying to debug my PEAR DB based session handler... it has severe problems with handling string variables.... I traced this to a failure to insert in value like 'varxxx|s:4:"1234" ;' into the sessions table The code is part of a sesion handler : function sess_write($key, $val) { global $SESS_CON, $SESS_DBH, $SESS_LIFE; $expiry = time() + $SESS_LIFE; $value = addslashes($val) $qry = "INSERT INTO sessions VALUES " . "('$key', $expiry, '" . $value . "')"; $parsedqry = $SESS_CON->prepare($qry); $qid = $SESS_CON->execute($parsedqry); return $qid; The insert is failing with an error "parse error at object" just after the the execute statement line. I am using Postgres 7.1 as my db... (using the native pgexec call works fine ) Any suggestions would be welcome Cheers Mark

« previous php.pear (#884) next »