Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

usort(): Invalid comparison function PROBLEM

Status
Not open for further replies.

postyman

Vendor
Jan 27, 2005
6
GB
Since upgrading my server to the latest php version my script brings up this error:

Warning: usort(): Invalid comparison function.
in /home/ukadzco/public_html/ppc/include/commands
/SearchCommand.php on line 236


This is the offending part of the script.
###########################################


function &deleteDupes(&$allFoundLinks)
{
usort($allFoundLinks,
array("LinkComparatorForDeleteDupesAlgorithm", "compare"));

$links = array();
foreach ($allFoundLinks as $i => $link) {
$links[$link->url] = &$allFoundLinks[$i];
}

return $links;
}



Thanks for any help given.
 
According to the PHP manual usort only takes two parameters. Your second parameter here is an array and a string with the functionname is expected.
 
Thank you for the info.

I am a newbie to php/mysql and so would ask if you could show what this part of the script should now look like.

I think this would help other newbies looking at this post also.
 
I don't quite understand - you said it is your script. Does that mean you wrote it? Also, the post suggests that it used to work before the upgrade - is that so?
If not, let us know where you got that script.
 
Sorry, I meant that it is my script in the sense that it is the script I am using on my site, not that it is a script that I wrote.

Indeed, the script was working perfectly OK until I upgraded the server to the new php format and then this error started appearing. This is obviously a general fault with a lot of scripts, if you put this error message in Google it brings up massive amounts of entries of sites that are getting the same error.

The script is a searchengine script I purchased from the writers, however they now seem not to be interested as I have emailed them without reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top