I have 2 tables in my database and I wanted a PHP output of the following:
Dogs 5
Cats 2
Birds 4
how can I do this?
The above is listing of categories with a count of how many dogs, cats and birds are in each category.
I have 2 tables in MySQL laid out like this:
Pets (MySql Table name)
AnimalNAME | AnimalCAT | AnimalDES
Bolt | 1 | Smelly dog
Minx | 2 | Snobby cat
Twit | 3 | Cherpy bird
Rony | 1 | Sneaky dog
Categories (MySql Table name)
AnimalCAT | Name
1 | Dogs
2 | Cats
3 | Birds
Here’s the query:
PHP example: