[SOLVED] Getting info out of my arrays
Posted: Tue Feb 27, 2007 6:14 am
This must be so simple to somebody that knows what they're doing, but I don't know what to search for to get an answer!
I'm quite happy normally pulling arrays out of a DB, but now I'm trying to extract a list of distinct results from a single field and am not sure how to go about it. I've got this so far:
It's not all bad as at least it seems to be returning the right number of results, but rather than the category name, I'm just getting 'array' as I don't know what to do to $category to get the info out. Any advice would be very much appreciated. Thanks.
I'm quite happy normally pulling arrays out of a DB, but now I'm trying to extract a list of distinct results from a single field and am not sure how to go about it. I've got this so far:
Code: Select all
$query = "SELECT DISTINCT Category FROM alba_catalogue ORDER BY Category asc";
$result = mysql_query($query);
while($category = mysql_fetch_array($result)){
echo"<p>$category</p>"; //Here's where I want a list of each of the categories
}