|
Posted by Richard Lynch on 04/29/05 03:43
On Thu, April 28, 2005 5:51 am, Mike Smith said:
> On 4/28/05, Richard Lynch <ceo@l-i-e.com> wrote:
>> I'm betting dollars to doughnuts that you've got a newline at the end of
>> $sql1 which is messing you up.
>
> You're right! Give that man a doughnut! When I tested the query in
> Query Analyzer. I hit [Enter] to format the query and make it
> readable, then copy-and-paste into the form. I have tried:
>
> str_replace("\n","",$sql1);
> and
> preg_replace("\n","",$sql1);
>
> to pull the new line out plus a few other variations. Those failed.
> I'll keep at, but any pointers are always appreciated.
If you are on a Mac, you'll have a "\r" in there as well.
Plus, some day, you might WANT to have a newline in your data, like:
UPDATE foo SET contents = "War\nand\nPeace"
What is probably safest is:
$sql1 = trim($sql1);
This strips off any whitespace before/after the query, which should not
affect any valid query, but will get rid of bogus newlines at the end.
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|