Re: Removing first word from a string?

From: Date: Tue, 04 Jan 2005 03:04:40 +0000
Subject: Re: Removing first word from a string?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-37961@lists.php.net to get a copy of this message
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

« previous php.db (#37961) next »