Jump to content

Script Error


wiseguy

Recommended Posts

I have a topsites script that is displaying an error after moving to a new web host. The error reads:
[code]Warning: fread() [function.fread]: Length parameter must be greater than 0. in /home/karaoket/public_html/top-karaoke-sites/admin/lib/class.functions.php on line 723[/code]

Any ideas on what would cause this?
Link to comment
https://forums.phpfreaks.com/topic/21666-script-error/
Share on other sites

just as ronald said, wrong second parameter.  my guess is that you're leaving it out:

[quote]string fread ( resource handle, int length )[/quote]

from the php manual - note that the second parameter is NOT optional.  this is usually what an fread() should look like:

$contents = fread($handle, [b]filesize('file name here')[/b]);
Link to comment
https://forums.phpfreaks.com/topic/21666-script-error/#findComment-96746
Share on other sites

[quote author=Daniel0 link=topic=109070.msg439439#msg439439 date=1158937117]
You could just change it to: [code]function get_file($url,$read='r') {
$a = fread(fopen($url, $read));
return $a;[/code]

The filesize thing just gets the total filesize, but fread will by default read everything, so you do not need that.
[/quote]

That just produced another error
[code]Warning: Wrong parameter count for fread() in /home/karaoket/public_html/top-karaoke-sites/admin/lib/class.functions.php on line 723[/code]
Link to comment
https://forums.phpfreaks.com/topic/21666-script-error/#findComment-96771
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.