My guess would be you don't have any write permission. Your first error is a permission denied using fopen(). The rest of your errors is caused by using the invalid filepointer '$file'. So check if you have any write permission! I don't have any on my commercial hosting either, but I do on my localhost (Windows 2000).
HTH, -- [Win2000 | Apache/1.3.23] [PHP/4.2.3 | MySQL/3.23.53] Ivo Fokkema PHP & MySQL programmer Leiden University Medical Centre Netherlands "Dore Van Hoorn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I get this warning when trying to write to a .txt file. Strange enough, I > don't get this error when trying to do the same this on my local server. > Can anybody help me with this?! > > Warning: fopen(respons.txt) [function.fopen]: failed to create stream: Permission > denied in /usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php > on line 206 > > Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php > on line 220 > > Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php > on line 238 > > Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php > on line 238 > > Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php > on line 238 > > Warning: fclose(): supplied argument is not a valid stream resource in /usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php > on line 242 > > > This is the code I use: > > if($answer == "send") > { > $bestand = "respons.txt"; > $file = fopen("$bestand",'a'); > $write = "respondent"; > $query6 = "SELECT $tabel2.questionnumber FROM $tabel2"; > $result6 = mysql_query($query6,$connection); > $gevonden6 = mysql_affected_rows($connection); > if($gevonden6 > "0") > { > while($myrow = mysql_fetch_row($result6)) > { > $questionnumber = $myrow[0]; > $write .= " question$questionnumber"; > } > } > $swrite .= "\r\n"; > fwrite($file, "$write"); > $questionnumber++; > $query5 = "SELECT * FROM $tabel1"; > $result5 = mysql_query($query5,$connection); > $found = mysql_affected_rows($connection); > if($found > "0") > { > while($myrow = mysql_fetch_row($result5)) > { > $respondent = $myrow[0]; > $write2 = "$respondent"; > for($i=1; $i<$questionnumber; $i++) > { > $answer = $myrow[$i]; > $write2 .= " $answer"; > } > $write2 .= "\r\n"; > fwrite($file, "$write2"); > } > } > fclose($file); > > In the mysql database I have one respondent, who has given answers to most > of the 58 questions. Is this perhaps the problem, that there is not a answer > to EVERY question, so sometimes $answer in the last for statement will be > empty? > > Thank you all very much in advance!! > > Dore. > +++++++++++++++++++++++++++++++++++ > N Dore van Hoorn > S s1000454 AlfaInformatica-RuG > E [EMAIL PROTECTED] > W http://www.let.rug.nl/~s1000454 > +++++++++++++++++++++++++++++++++++ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php