Re: Fwd: [PHP] Re: usort(): The argument should be an array
| From: | Chris | Date: | Thu, 02 Mar 2006 01:01:00 +0000 |
| Subject: | Re: Fwd: [PHP] Re: usort(): The argument should be an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231304@lists.php.net to get a copy of this message | ||
Remember14a@aol.com wrote:
I have done as per your instructions, and put var_dump($res); BEFORE usort($res, "cmp"); Please, go again to http://www.abcdefg.us/search/search.php Enter law we get this output. NULL *Warning*: usort(): The argument should be an array in */home2/wwwabcde/public_html/search/searchfuncs.php* on line *301*So you're not setting $res at all. You should be doing: # INITIALIZE RESULTS ARRAY HERE. $res = array(); while($row = mysql_fetch_assoc($query_result)) { .......................... $res[$i]['size'] = $row[5]; $res[$i]['weight'] = $result_array[$row[0]]; $i++; } usort($res, "cmp"); that will fix your problem (I know someone suggested this before too). -- Postgresql & php tutorials http://www.designmagick.com/