Jump to content

[RESOLVED] problem with fopen and fclose :)


Recommended Posts



Just put some values there and click "Pošalji narudžbenicu".


Now comes processorder.php and i managed to get everything to work but now when i try to write orders to txt file i get these two errors:


Warning: fwrite(): supplied argument is not a valid stream resource in /home/crtaci0/public_html/php/processorder.php on line 151


Warning: fclose(): supplied argument is not a valid stream resource in /home/crtaci0/public_html/php/processorder.php on line 152


I am learning PHP and i am simply following instructions from a book, this is what the book tells me to write... :)


$outputstring = $date."\t".$gumeqty." gume \t".$uljeqty." ulje \t".$auspuhqty." auspuh\t\$".$totalamount."\t".$adresa."\n";


@ $fp = fopen("/orders.txt", 'w');


if (!fp)


echo '<p><strong>Vaša narudžbina nije mogla da se obradi trenutno. Molimo vas, pokušajte kasnije.</p></strong></body></html>';




fwrite($fp, $outputstring, strlen($outputstring));



echo '<p>Narudžbina obrađena!</p>'









Woooops, this was the problem:


@ $fp = fopen("/orders.txt", 'w');


this / was screwing me... :lol:

Edited by GaVrA
Link to comment
Share on other sites

  • Management

The issue/request this topic was opened for has now been resolved. If you need further assistance, please open a new topic.


If this topic was closed prematurely, please contact me so I can re-open it. :lol:



Topic Closed

Board Rules - Available Products - Need a Custom Work?


< Don't PM me for support, post in the forum or submit a ticket from the client area instead! >

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.