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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remember14a@xxxxxxx 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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux