Re: usort(): The argument should be an array

From: Date: Tue, 28 Feb 2006 16:55:46 +0000
Subject: Re: usort(): The argument should be an array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-231212@lists.php.net to get a copy of this message
On 28/02/06, Remember14a@aol.com <Remember14a@aol.com> wrote: > > No this doesnt solve error. > let me give you more details to understand problem with the said code. > > go to this link, please. > > http://www.abcdefg.us/search/search.php > > in search enter, > Justice, you get response without an error. > > Now enter law, > > you get error, pasted below, > > Warning: usort(): The argument should be an array in > /home2/wwwabcde/public_html/search/searchfuncs.php on line > 300 Yeah, sure. So you know $res *isn't* an array, which is why you're getting the warning that "The argument should be an array". So you need to find out what *is* in $res, which is why I suggested the print_r(). Now do a var_dump($res) and see what *is* in $res. Then you'll have to work out *why* it's not an array - and the answer to that is somewhere in those 300 lines of code you can't post. The few lines at the end of the loop seem to be treating $res as an array. But as it's *not* an array, either those lines aren't being executed or you've initialised $res to something silly beforehand, like a string. -robin

« previous php.general (#231212) next »