Jump to content

[RESOLVED] problem with fopen and fclose :)


Recommended Posts

Posted (edited)

http://www.crtaci.info/php/orderfrom.html

 

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>';

exit;

}

 

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

fclose($fp);

 

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

 

 

 

 

EDIT:

 

 

 

Woooops, this was the problem:

 

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

 

this / was screwing me... :lol:

Edited by GaVrA
  • Management
Posted

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! >

Guest
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.