If I put this code
$res = array();
while($row = mysql_fetch_assoc($query_result)) { before
usort($res, "cmp"); give this error
Parse error: parse error, unexpected $ in /home2/wwwabcde/public_html/search/searchfuncs.php on line 316
even putting this code before
$res[$i]['size'] = $row[5];
$res[$i]['weight'] = $result_array[$row[0]]; $i++; } usort($res, "cmp"); gives same error. |
--- Begin Message ---
- To: Remember14a@xxxxxxx
- Subject: Re: Fwd: Re: usort(): The argument should be an array
- From: Chris <dmagick@xxxxxxxxx>
- Date: Thu, 02 Mar 2006 12:01:00 +1100
- Cc: php-general@xxxxxxxxxxxxx
- In-reply-to: <22d.7427268.31379b93@xxxxxxx>
- References: <22d.7427268.31379b93@xxxxxxx>
- User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)
Remember14a@xxxxxxx wrote:I have done as per your instructions, and putvar_dump($res);BEFORE usort($res, "cmp");Please, go again tohttp://www.abcdefg.us/search/search.phpEnter 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/
--- End Message ---
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php