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

From: Date: Thu, 02 Mar 2006 01:26:54 +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-231306@lists.php.net to get a copy of this message
Remember14a@aol.com wrote:
*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.
You need to put $res = array(); before you start looping over your mysql query results. We didn't see all your code so we can't give you an *exact* line number or place to put it. You need to adjust what you were told to fit into your code. If you need more help, post your entire code block in http://www.pastebin.com and send us a url to look at. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#231306) next »