Yes thanks, that far i got, but how can i call the values in different parts
of the page, whereever i want.
So for instance i have 10 tables and in the first one i call $counted_rows_4
or so, and in the next one $counted_rows_9. So they correspond with the
category. It doesnt matter how i call them, as long as i can call them
individually.
Hope you get it, and sorry for me being a noob. I googled on this, searched the
mysql site, but couldn't find anything that makes sense to me.
Thanks again.
"Kevin" wrote in message ...
> What problem are you having? Obviously you need to replace the field and
> table names with the ones from your table.
>
> > Well, to begin: Thank you for helping.
> >
> > Ehm i know i am not asking for the first, because this would force me
> > to run the query for each category.
> >
> > Could you please explain a little bit more about the second one? I can't
> > seem
> > to get it to work...
:s
> >
> > Thanks again
> >
> >
> >
> >> To get the number of rows with a category '4' use:
> >>
> >> SELECT COUNT( * ) FROM `table` WHERE category = '4';
> >>
> >> To get the row count for all categories in a single query (I think what
> >> you're asking for):
> >>
> >> SELECT COUNT( category ) AS repetitions, category FROM `table`
> >> GROUP BY category
> >>
> >> - Kevin
> >>
> >> > Hi there,
> >> >
> >> > I have a small question:
> >> > I have a table with lots of rows in it. Of course all have a different
> >> > id,
> >> > but each can be assigned to a certain category. Categories correspond
> >> > with 1 - 10.
> >> >
> >> > So a row looks like this: 'unique id | 4'
> >> >
> >> > What i want is to do a count how much rows belong to a certain
> >> > category.
> >> > Is it possible to do the following (from 1 query)
> >> >
> >> > echo $counted_rows['4'];
> >> >
> >> > Which sould return the number of rows with category '4';
> >> >
> >> > Or is there anything similar if this is wrong?
> >> >
> >> > Any help is great!!
>> Stay informed about: MySQL Count() question.. (mysql newb)