|
Posted by comp.lang.php on 11/18/61 11:42
noone wrote:
> comp.lang.php wrote:
>
> > if ($willLimitByDB) $sql = preg_replace('/#([^#]+)#/i', '$$1',
> > $sql);
>
> > This does not give me the results I want, instead of the value of
> > $where in $sql, I literally get '$where' instead.
>
> > How do I substitute #where# with $where?
>
> > Thanx
> > Phil
>
>
> given: $sql="select * from table";
> and $where="where a = 'a'";
>
> $sql .= $where;
> //concatenate it before you edit it...
> if ($willLimitByDB) $sql = preg_replace('/#([^#]+)#/i', '$$1', $sql);
Thanx but you were looking at the wrong "WHERE.."
the query is this
"SELECT id, first_name, last_name, (SELECT count(id) #where#) as
paginate_total, email, address, city, state, zip, phone FROM person
$where "
You want "#where#" inside the subselect substituted with $where
I got it though thanx to someone that knows RegExp modifiers
$sql = preg_replace('/#([^#]+)#/ie', '$$1', $sql);
Phil
Navigation:
[Reply to this message]
|