I have been trying similar arrangements, but to no avail.  I think it
has something to do with the actual string I am checking - it's an SQL
statement.  I am trying to create a log of SQL statements in a textfile,
and the newline/return characters that people put in the TEXTAREA is
screwing it up.  But I can't for the life of me figure out why test code
such as this does not strip out the \n's...

$sql = "UPDATE contact set firstname = 'rory', lastname = 'jones',
interest = 'rory', optin = 'yes', comments = 'hello\n\n,rory' WHERE id =


it is still outputting the following to my log:

UPDATE contact set firstname = 'rory', lastname = 'jones' interest =
'rory' optin = 'yes' comments = 'hello

,rory' WHERE id = 5055;   

Any help is appreciated!


On Sat, 25 Aug 2001 11:17:43 -0700, Rory O'Connor <[EMAIL PROTECTED]>
>I had the same problem, I was writing the textarea to a text file,and
>reading it using fgets, therefor, any unspecified newlines would really
>my script up. This probably isn't the best solution, but it'swhat I
>works fine.
>That's all there was to it, it replaced all newlines and returns with
>blanks. You can change it to replace with breaks if you are outputting
to an
>HTML file, hope I was able to help,
>----- Original Message -----
>From: Rory O'Connor <[EMAIL PROTECTED]>
>Newsgroups: php.general
>Sent: Saturday, August 25, 2001 9:27 AM
>Subject: Stripping line break characters
>> I need to strip line break characters (or whatever the character is
>> results from users hitting their "enter" key inside a TEXTAREA form
>> input) from a string.  These characters will appear anywhere in the
>> string, not just at the end.  In perl, the regex would look
>> like this...
>> $a="a\nb\nc\nd\n\n\n";
>> $b=$/;
>> $a =~ s/$b//g;  # produces "abcd"
>> but i'm a newbie and i don't know how I can translate this to PHP
>> to do the same thing.  Any help is appreciated!
>> Thanks!
>> providing the finest in midget technology

providing the finest in midget technology

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to