Re: str_replace question

From: Date: Thu, 06 Jan 2005 14:34:00 +0000
Subject: Re: str_replace question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38005@lists.php.net to get a copy of this message
whats likely happening is the sql is being built on the fly. and he's malformed it somewhere... A neat little trick would be to create the initial part of the statement with a predefined where clause based on some record state. For instance, we use a record_deleted field, since we don't delete data. He could start his statement by automatically looking for it select * from tablename where record_deleted = 'No' then any additional clauses that get added all require the AND keyword. No more problem bastien
From: Brent Baisley <brent@landover.com> To: "Chris Payne" <cjp@planetoxygene.com> CC: <php-db@lists.php.net> Subject: Re: [PHP-DB] str_replace question Date: Thu, 6 Jan 2005 09:20:47 -0500 I can't think of an instance where a query would have the phrase "WHERE AND". Perhaps if you post the contents of the $additionalsql variable, we can tell you why it's not working. You may actually be looking to use an array for your search words in str_replace(), or perhaps grep. On Jan 5, 2005, at 8:05 PM, Chris Payne wrote:
Hi there everyone, 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); 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 would appreciate any help on this, as it’s very important. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.6.7 - Release Date: 12/30/2004
-- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#38005) next »