> hi all! > > i have a simple program to open and write a file. > but the file is not getting created. > can anyone please spot the mistake? > giving the code below. > > thanks a lot, > diksha. > > <?php > echo"hi?how are u doing??"; > $fp = fopen ("sandrew.html", "w"); > string="<html><head><title>hi</title></head><body>i am > > fine</body></html>"; > $contents=fwrite($fp,string); > echo "'$contents'"; > fclose($fp); > ?>
Hi Diksha Some comments... . Your string variable needs to be defined and referenced as $string not just string - unless this is a typo in your post . fwrite() returns an int - you are assigning this int to $contents - what exactly are you expecting $contents to be set to? . Does your user or web server process have the permissions to create files in the directory? . What does readfile('sandrew.html'); after your fclose($fp) return? HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php