Flying Monkey
01-12-2007, 08:27 PM
Hi. Please forgive my ignorance. I am teaching myself php and mysql with the help of Luke Welling and Laura Thomson's "PHP and MySQL Web Development. I have been getting this error:
Warning: feof(): supplied argument is not a valid stream resource
which loops down the browser page. I've tried over and over but I can't find my syntax error and I've contacted my server administrator who says file functions should be operational. Heres the code in question:
<?php
$order = 0;
@ $fp = fopen("DOCUMENT_ROOT/../orders/orders.txt", 'r');
if (!fp) {
echo '<p><strong>No orders pending.</strong></p></body></html>';
exit;
}
while (!feof($fp)) {
$order = fgets($fp, 999);
echo $order.'<br />';
}
fclose($fp);
?>
orders.txt is sitting in a folder called orders outside the ROOT folder
Any help is greatly appreciated.
Monkeyman
Warning: feof(): supplied argument is not a valid stream resource
which loops down the browser page. I've tried over and over but I can't find my syntax error and I've contacted my server administrator who says file functions should be operational. Heres the code in question:
<?php
$order = 0;
@ $fp = fopen("DOCUMENT_ROOT/../orders/orders.txt", 'r');
if (!fp) {
echo '<p><strong>No orders pending.</strong></p></body></html>';
exit;
}
while (!feof($fp)) {
$order = fgets($fp, 999);
echo $order.'<br />';
}
fclose($fp);
?>
orders.txt is sitting in a folder called orders outside the ROOT folder
Any help is greatly appreciated.
Monkeyman