Marek Kilimajer <[EMAIL PROTECTED]> wrote: > I always do it this way: > > $condition=''; > foreach ($phrases as $key=>$val) { > if (($val != "the") && ($val != "and")) { > $condition.= "name like '%$val%' $logic"; > } > } > $condition=substr($condition, 0, strlen($condition) - strlen($logic)); > $sql .= $condition;
another way to truncat the string: $logic_len = strlen($logic); $condition = substr($condition, 0, -($logic_len)); > > > >$length = strlen($sql); > >$newlen = $length - 4; > >$sql[$newlen].= " order by name"; > >echo $sql; > > > > > > > Curt -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php