Jump to content

unpack() problem


firestarapple

Recommended Posts

I am having problem with my search engine. It seems to work fine

in PHP 4 but not in PHP5. The error was:

 

Warning: unpack() [function.unpack]: Type N: not enough input, need 4, have 1 in /var/www/vhosts/newsweekshowcase.com/httpdocs/newsweekshowcase/site-common-files/index-template-b(59) : eval()'d code on line 174

No fread2

 

Below are some of the codes:+

 

for ($j=0; $j<count($query_arr); $j++) {

    $query = $query_arr[$j];

    $allres[$j] = array();

 

    if ($INDEXING_SCHEME == 1) {

    $substring_length = strlen($query);

    } else {

    $substring_length = 4;

    }

    $hash_value = abs(hashnew(substr($query,0,$substring_length)) % $HASHSIZE);

   

   

   

    fseek($fp_HASH,$hash_value*4,0);

    $dum = fread($fp_HASH,4) or die("No fread");

    $dum = unpack("Ndum", $dum);

    fseek($fp_HASHWORDS,$dum['dum'],0);

    $dum = fread($fp_HASHWORDS,4);

    $dum1 = unpack("Ndum", $dum);

   

   

   

    for ($i=0; $i<$dum1['dum']; $i++) {

        $dum = fread($fp_HASHWORDS,8) or die("No fread2");

 

 

Why this error appear?Please help!!!

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/137012-unpack-problem/
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.