Re: str_replace question
| From: | Jason Wong | Date: | Thu, 06 Jan 2005 02:26:05 +0000 |
| Subject: | Re: str_replace question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37992@lists.php.net to get a copy of this message | ||
On Thursday 06 January 2005 09:38, Chris Payne wrote:
> I’m having a weird problem and I’m not sure why, if I try to replace WHERE
> AND with just WHERE it won’t do it, but if I try to replace WHERE or AND by
> themselves it WILL do it, but I cannot replace BOTH of them from a single
> string, is something wrong below?
>
> $additionalsql = str_replace("WHERE AND", "WHERE", $additionalsql);
The code looks OK. Most likely that $additionalsql DOES NOT contain what you
think it contains -- check case, check space.
> Basically I’m trying to replace WHERE AND with just WHERE as I’m building a
> very complex SQL query and it’s a difficult one, and I have a solution that
> works perfectly but I need this to work in order to do it.
I'm pretty sure a simple if-clause somewhere would prevent the extraneous AND
from appearing in $additionalsql.
--
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