Radio button help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tom_b
    New Member
    • Jan 2006
    • 18

    #1

    Radio button help!

    Hi! I"m sure this is pretty basic, I have a form with two radio buttons (see code), when I click submit the info goes into a mysql database as either 'p' or 'b'. I need to count how many 'ps' and 'bs' I have and outut the results.

    <p>Business:&nb sp;<input type="radio" name="ctype" value="biz" />
    Personal:&nbsp; <input type="radio" checked name="ctype" value="pers" /></p>

    Thanks!!!
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Are you asking for the MySql statement? Assuming that you are and that your table is called table and the column name ctype then I would try

    SELECT ctype, COUNT(ctype) AS count FROM table GROUP BY ctype;

    Comment

    Working...