Re: [PHP] Generating a new line in a text file

2002-01-18 Thread DL Neil

Chris,
\n = *nix
\r = Mac
\r\n = PC
(now that you've 'dropped' MS Notepad into the conversation...) The simplest M$ 
tools content themselves with
black blocks (apparently not being interested in your comfort), but the more 
sophisticated tools will sometimes
oblige...
=dn


- Original Message -
From: Chris Janes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 18 January 2002 05:15
Subject: Re: [PHP] Generating a new line in a text file


 :
 : Ah, so you're opening the file in something that doesn't understand
 : newlines and prefers line feeds, then.
 :
 : In that case you'll want to use \r instead of \n.
 :
 : Jason

 You'll never guess what, that doesn't work either... still pretty black
 blocks, but no new line...

 In a foolish move (perhaps) I'm opening the file in MS Notepad (I know,
 there are better things to use, but I don't have them). I hope that
 eventually I'll be able to only have to open the file to check how many
 quotes are in it, and check spelling and the like...

 Bah, and I was hoping that working on this would help me get to sleep!
 Ah well...

 Chris


 --
 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]




-- 
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]




Re: [PHP] Generating a new line in a text file

2002-01-18 Thread Chris Janes



: Chris,
: \n = *nix
: \r = Mac
: \r\n = PC
: (now that you've 'dropped' MS Notepad into the conversation...) The
simplest M$ tools content themselves with
: black blocks (apparently not being interested in your comfort), but
the more sophisticated tools will sometimes
: oblige...
: =dn
:

Excellent, it would appeared to have been a combination of the quotes
and the right newline command that was the problem, I had in fact tried
various combinations of the two, but apparently not quite hit the right
one. Like I said, it was something totally obvious. Guess it was just a
case of not seeing the wood for the trees.

I would have mentioned the MS Notepad usage earlier, only it was 4:30
in the morning when I decided to ask about it, so my mind wasn't exactly
in a high gear. But it's sorted now, so cheers to both you and Jason for
helping out!

Chris


-- 
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]




Re: [PHP] Generating a new line in a text file

2002-01-18 Thread Martin Wickman

Jason Murray wrote:

: Don't know why it's got everyone else stumped.
:
: \n is the new line character. Make sure you use it in  and
: not in ''.
:
: Jason

Unfortunately, that doesn't work either, it changes the \n that 
appeared at the end of the new line to a single black block. It 
does not put the next quote onto a new line. 

 
 Ah, so you're opening the file in something that doesn't understand
 newlines and prefers line feeds, then.
 
 In that case you'll want to use \r instead of \n.


Na, he's posting using MS Outlook so I guess he is using Windows. In 
that case use \r\n.


-- 
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]




Re: [PHP] Generating a new line in a text file

2002-01-18 Thread TD - Sales International Holland B.V.

On Friday 18 January 2002 17:00, you wrote:

FYI, In windows a newline is usualy made by CRLF (Carriage Return (\r) , Line 
Feed (\n)), in linux/unix it's usually just LF (\n)


 Jason Murray wrote:
 : Don't know why it's got everyone else stumped.
 :
 : \n is the new line character. Make sure you use it in  and
 : not in ''.
 :
 : Jason
 
 Unfortunately, that doesn't work either, it changes the \n that
 appeared at the end of the new line to a single black block. It
 does not put the next quote onto a new line.
 
  Ah, so you're opening the file in something that doesn't understand
  newlines and prefers line feeds, then.
 
  In that case you'll want to use \r instead of \n.

 Na, he's posting using MS Outlook so I guess he is using Windows. In
 that case use \r\n.

-- 
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]




[PHP] Generating a new line in a text file

2002-01-17 Thread Chris Janes

It should be fairly simple, but it's got me and everyone else I've asked
utterly stumped, all I need to do is place the data from a form on a
newline in a text file, I can get the data into the text file, but I
can't seem to get it on a new line.

Here's what I have at the moment:

$quote = stripslashes($newquote);
$quote = sprintf($quote%s,'\n');
$quotage = fopen(quotes.txt,a);
fputs($quotage, $quote);
fclose($quotage);
echopNew quote added to quotes.txt/p;
echo $quote;

The form is a standard form that posts back to it's own page, an if
statement picks up a hidden form entry and shifts the data across to the
above code, so far so good. But it's at this point that I become stuck.
What do I need to do to get it to put the new quote onto a new line of
the text file?

The reason I need it this way is that the code that pulls the quotes
back out again chooses them randomly by line. (it's a somewhat dodgy
random number generator in essence, but it does the job)

If all else fails, I could put the whole lot into a mysql database table
and redo the code for the random quote generator, but using a database
when a flat file will do seems like overkill to me.

TIA

Chris Janes


-- 
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]




RE: [PHP] Generating a new line in a text file

2002-01-17 Thread Jason Murray

 It should be fairly simple, but it's got me and everyone else 
 I've asked utterly stumped, all I need to do is place the data 
 from a form on a newline in a text file, I can get the data into 
 the text file, but I can't seem to get it on a new line.

Don't know why it's got everyone else stumped.

\n is the new line character. Make sure you use it in  and
not in ''.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
Work now, freak later!

-- 
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]




Re: [PHP] Generating a new line in a text file

2002-01-17 Thread Chris Janes


:
: Don't know why it's got everyone else stumped.
:
: \n is the new line character. Make sure you use it in  and
: not in ''.
:
: Jason
:

Unfortunately, that doesn't work either, it changes the \n that appeared
at the end of the new line to a single black block. It does not put the
next quote onto a new line. This is why it has us stumped, we've tried
all sorts of combinations of quotes. Ok, so we may have missed the most
obvious one. But the manual hasn't been much help with this either, and
I can't find an online tutorial that covers it.

Chris


-- 
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]




RE: [PHP] Generating a new line in a text file

2002-01-17 Thread Jason Murray

 : Don't know why it's got everyone else stumped.
 :
 : \n is the new line character. Make sure you use it in  and
 : not in ''.
 :
 : Jason
 
 Unfortunately, that doesn't work either, it changes the \n that 
 appeared at the end of the new line to a single black block. It 
 does not put the next quote onto a new line. 

Ah, so you're opening the file in something that doesn't understand
newlines and prefers line feeds, then.

In that case you'll want to use \r instead of \n.

Jason

-- 
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]




Re: [PHP] Generating a new line in a text file

2002-01-17 Thread Chris Janes

:
: Ah, so you're opening the file in something that doesn't understand
: newlines and prefers line feeds, then.
:
: In that case you'll want to use \r instead of \n.
:
: Jason

You'll never guess what, that doesn't work either... still pretty black
blocks, but no new line...

In a foolish move (perhaps) I'm opening the file in MS Notepad (I know,
there are better things to use, but I don't have them). I hope that
eventually I'll be able to only have to open the file to check how many
quotes are in it, and check spelling and the like...

Bah, and I was hoping that working on this would help me get to sleep!
Ah well...

Chris


-- 
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]