Re: fwrite() question

From: Date: Tue, 01 Jul 2003 16:03:34 +0000
Subject: Re: fwrite() question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-153577@lists.php.net to get a copy of this message
On Tuesday 01 July 2003 22:12, Adam Williams wrote: > when I do that, nothing is written to news.txt, and I'm not sure why. Well find out why! > This is the entire script: > > <?php > if ($_POST['news']) > { > $fp = fopen( "news.txt", "w"); Add some error-checking to see whether fopen() was successful. See examples in manual for details. > $success = fwrite( $fp, "$POST_['news']" ); ^^^^^^^^^^^^^^^^ As has already been pointed out you don't need the double-quotes. And it should be $_POST['news']. > fclose($fp); > > if (!success) This should be: if (!$success) And please trim your post! -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* We come to bury DOS, not to praise it. (Paul Vojta, vojta@math.berkeley.edu, paraphrasing a quote of Shakespeare) */

« previous php.general (#153577) next »