Re: array_unique() and count issue
| From: | Unknown Sender | Date: | Fri, 28 Sep 2001 06:50:00 +0000 |
| Subject: | Re: array_unique() and count issue | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-69128@lists.php.net to get a copy of this message | ||
Hi
On Sat, Aug 18, 2001 at 12:57:15AM -0700, CGI GUY wrote:
> Method 1:
> $count =
> array_unique(mysql_fetch_array($mysql_result));
This doesn't work since array_unique doesn't handle array of arrays.
> Method 2:
> $array = mysql_fetch_array($mysql_result);
> $newarray = array_values($array);
array_values doesn't help, if you have an array of arrays the values
are the arrays and you get a new array of those.
If all the values you want to look at are from the same field in your
table, you could perhaps try
while($row = mysql_fetch_row($queryresult)){
$data[] = $row[0];
}
$count = array_unique($data);
Stig