you close the input file in while loop ( fclose($fp); )
"Bryan Koschmann - Gkt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone give me a hand here? I am really lost as to what is
going on.
> I have a file that looks like this
>
> user1,Store 1 - ABC street
> user2,Store 2 - Northside
> user3,Store 3 - East
>
> I try to run my code, but I get a php log filled (~33 megs, the
input file
> is only 12 lines):
>
> [06-Mar-2003 15:22:53] PHP Warning: feof(): 1 is not a valid
File-Handle
> resource in /home/perf/create_prefs.php on line 7
> [06-Mar-2003 15:22:53] PHP Warning: fgets(): 1 is not a valid
File-Handle
> resource in /home/perf/create_prefs.php on line 8
> [06-Mar-2003 15:22:53] PHP Warning: feof(): 1 is not a valid
File-Handle
> resource in /home/perf/create_prefs.php on line 7
> [06-Mar-2003 15:22:53] PHP Warning: fgets(): 1 is not a valid
File-Handle
> resource in /home/perf/create_prefs.php on line 8
>
> While it is running it just stalls.
>
> This is my code:
>
> $fp = fopen("emaillist", "r");
> if (!$fp)
> die("Error opening file. $php_errormsg");
>
> while (!feof($fp)) {
> $buffer = fgets($fp, 4096);
> echo $buffer;
> $row = explode(',', $buffer);
> if (!empty($row[0])) {
> $user = "$row[0]";
> $name = "$row[1]";
> $stuff = "[EMAIL PROTECTED]" .
>
"chosen_theme\=../themes/mystore_theme.php\n" .
> "show_html_default\=0\n" .
> "javascript_on\=1\n" .
> "full_name\=$name\n" .
> "use_signature\=0\n" .
> "prefix_sig\=0\n";
>
> $fileout = $user . "_perf.pref";
> $fout = fopen("$fileout", "w");
> fputs($fout, "$stuff");
> fclose($fp);
> fclose($fout);
> }
> }
>
>
> Please help! I keep re-reading the docs at php.net for fopen fgets
and all
> that with no luck!
>
> Thanks,
>
> Bryan
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php