Re: Removing first word from a string?

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

 



On Tuesday 04 January 2005 10:46, Chris Payne wrote:

> I am building a dynamic MySQL query for a project I am working on, but
> there are instances where it products WHERE AND instead of WHERE city etc
> â.. due to the nature of the system I am developing.  My question is, how
> can I remove the FIRST â ANDâ from a string if it is present, but leave all
> other AND statements in the string?
>
> I would really appreciate any help on this.  I can do a find and replace on
> a string no problem, but just want it to be removed IF it is the FIRST word
> in the string.

You can use preg_replace(), but the better solution would be to revise your 
logic so that you produce correctly formed SQL in the first place.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
New Year Resolution: Ignore top posted posts

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux