I need correct mysql_fetch_ for my script.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Lucnet
Forum Commoner
Posts: 61
Joined: Sat Jun 26, 2004 5:28 pm
Location: Alabama
Contact:

I need correct mysql_fetch_ for my script.

Post by Lucnet »

I have been looking at the mysql functions. I am unsure on how to desplay a the number of a certain value. What my script is for is testimonials. On the admin side I am wanting to be able to display beside the word Active, New, Onhold the amount of testimonials in that catigory. The way they are marked in the database is n=new, y=approved, and h=onhold. How can I get it to display the number of testimonials by the coresponding word/catigory.

You can see the script here. http://www.lsscripts.com/lst/admin/ If you look in the Records section you will see that I am wanting the number to display on the right side of each word.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

MySQL's 'GROUP BY' would be a good place to start... Scan through the following parts of the manual for more info:
http://dev.mysql.com/doc/mysql/en/SELECT.html
http://dev.mysql.com/doc/mysql/en/Group ... fiers.html

Basicly, you could do something similiar to...

Code: Select all

select category, count(category) from table group by category
Post Reply