RE: query2xml like search

From: Date: Fri, 23 Nov 2007 18:28:48 +0000
Subject: RE: query2xml like search
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28209@lists.php.net to get a copy of this message
Hi shqlsl! This should have gone to pear-general@lists.php.net. shqlsl wrote: > > $sqlArray=array( > 'data'=>array(":$author"), > 'query'=>"select content from {$db_prefix}novel where author=?" > ); > > what can i do like search? > Below fail > > > $sqlArray=array( > 'data'=>array(":$author"), > 'query'=>"select content from {$db_prefix}novel where author like > '?'" > ); Don't place quotes around the question mark; i.e. "SELECT * FROM table WHERE column LIKE ?" This will work with mysql and postgresql; but AFAIK some RDBMS do not support "LIKE ?" (e.g. interbase/firebird) BTW: make sure $db_prefix is not unchecked user-supplied data; otherwise you would be creating an SQL-injection vulnerability! Cheers, Lukas

« previous php.pear.general (#28209) next »