Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

How to display the total number of same text entries from a table (php)?

New Here ,
Apr 30, 2012 Apr 30, 2012

Copy link to clipboard

Copied

Hello,

I have a database "choir" with the table "members" which has the following data structure:

NameVoice
Jennasoprano
Dannaalto
Roxyalto
Damientenor
Carmenalto
Daisysoprano

Diana

alto
Roberttenor
Johnbass

With Dreamweaver php, any help me on how can I display in a webpage the total number of "alto", in this case: 4.

Thanks,

Luci.

TOPICS
Server side applications

Views

880
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 30, 2012 Apr 30, 2012

Copy link to clipboard

Copied

Create a new Recordset in Dreamweaver and run the following SQL:

SELECT voice, count(voice) AS voiceCount FROM choir GROUP BY voice

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2012 Apr 30, 2012

Copy link to clipboard

Copied

Hi,

Thanks for your fast reply. I've used your proposal and it works fine.

However, I get only the value 4.

What I would like is:

alto 4

bass 1

soprano 2

tenor 2

Any help on how can I achieve this?

Thank you very much?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 30, 2012 Apr 30, 2012

Copy link to clipboard

Copied

SELECT voice, COUNT(*) as voice FROM choir GROUP BY voice ORDER BY voice DESC;

This will give you plain voiceid - count

SELECT voice, COUNT(*) as name FROM choir GROUP BY voice ORDER BY voice DESC;

This will give you name - voice - count

Trust it helps.

Cheers,

ST

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2012 Apr 30, 2012

Copy link to clipboard

Copied

LATEST

Thank you very much. This is what I wanted.

I have also another harder request. I've put it separately.

If you could help me on that too, I would be higly appreciating.

Thanks!

http://forums.adobe.com/thread/997110?tstart=0

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines