Re: [PHP] how can i creat a file and write a string to it!

2001-07-16 Thread Jason Bell

You need to open the file before you can actually write to it

try this:

$fp = fopen($file, w);
fwrite($fp, $articletext);
fclose($fp);


- Original Message - 
From: sunny AT wde [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Sunday, July 15, 2001 10:27 AM
Subject: [PHP] how can i creat a file and write a string to it!


 i've been looking for an adequate answer all morning in the archives,
 but can't find one, neithr can i understand the manual.
 
 all i want to do is for php to take the strong sent to it through a
 form, and create a new file with a name 2.html for example, and
 write the string to it.
 
 how can i quickly do this please?
 
 i got this so far but that gives me some filehandler problem. i'm
 running off a unix system btw.
 
   $lastid = mysql_insert_id() ; 
   $root = /home/articles/;
   $file = $root . $lastid . .html;
 
   fwrite($file, $articletext);
 
 tia!!
 
 /sunny
 
 
 Do You Yahoo!?
 Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
 or your free @yahoo.ie address at http://mail.yahoo.ie
 
 -- 
 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]




[PHP] how can i creat a file and write a string to it!

2001-07-15 Thread sunny AT wde

i've been looking for an adequate answer all morning in the archives,
but can't find one, neithr can i understand the manual.

all i want to do is for php to take the strong sent to it through a
form, and create a new file with a name 2.html for example, and
write the string to it.

how can i quickly do this please?

i got this so far but that gives me some filehandler problem. i'm
running off a unix system btw.

  $lastid = mysql_insert_id() ; 
  $root = /home/articles/;
  $file = $root . $lastid . .html;

  fwrite($file, $articletext);

tia!!

/sunny


Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

-- 
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] how can i creat a file and write a string to it!

2001-07-15 Thread John Meyer

At 06:27 PM 7/15/01 +0100, sunny AT wde wrote:
i've been looking for an adequate answer all morning in the archives,

   fwrite($file, $articletext);


Don't you have to do a fopen beforehand?


John Meyer
[EMAIL PROTECTED]
Programmer


If we didn't have Microsoft, we'd have to blame ourselves for all of our 
programs crashing


-- 
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] how can i creat a file and write a string to it!

2001-07-15 Thread Chris Anderson

Try looking under Filesystem functions in the manual.
- Original Message - 
From: sunny AT wde [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Sunday, July 15, 2001 1:27 PM
Subject: [PHP] how can i creat a file and write a string to it!


 i've been looking for an adequate answer all morning in the archives,
 but can't find one, neithr can i understand the manual.
 
 all i want to do is for php to take the strong sent to it through a
 form, and create a new file with a name 2.html for example, and
 write the string to it.
 
 how can i quickly do this please?
 
 i got this so far but that gives me some filehandler problem. i'm
 running off a unix system btw.
 
   $lastid = mysql_insert_id() ; 
   $root = /home/articles/;
   $file = $root . $lastid . .html;
 
   fwrite($file, $articletext);
 
 tia!!
 
 /sunny
 
 
 Do You Yahoo!?
 Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
 or your free @yahoo.ie address at http://mail.yahoo.ie
 
 -- 
 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]