fopen problem
| From: | Dane Morgan | Date: | Thu, 21 Dec 2000 23:06:04 +0000 |
| Subject: | fopen problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31488@lists.php.net to get a copy of this message | ||
Hi all.
I know this is probably a dumb question, but hey, I'm new!
I am writing a script that I need to write a text file to save a "chapter"
submitted from a form... Basically it is one of those contributive story
things.
Anyhow I am getting a parse error on line 62 which is where my fputs()
lives. What am I missing here?
//create the new record
$sql = "INSERT INTO story1 (username,email,title,parent) VALUES
('$username','$email','$title','$parent')";
$thisrec = mysql_query($sql);
//set the file name for the chapter text
$file = 'text.txt';// . $thisrec['sid'] . '.txt';
//update the record with the file name
$id = $thisrec['sid'];
$record = mysql_query("UPDATE story1 SET file='$file' WHERE
sid='$id'");
//Create the chapter's text file and open it for writing
$filehandle = fopen($file,"w");
// Write the file
fputs( $filehandle, $chaptext, strlen( $chaptext ) );
// and close it
fclose($filehandle);