Jump to content

HELP


cyberangel

Recommended Posts

 

Hi Everybody,

 

I am new to MySQL and PHP and am experimenting a bit.

Now I got a table which is updated by a form with radio buttons. The checked values of the Radio Buttons are "Very Good, Good and Bad". The problem that I am currently having is that The Radio Buttons update multilple columns, say Column1, Column2 and Column3. Means that all the three columns contain only these 3 values repeatedly. I to make reports I can count the Value "Very Good" in a columns using the following query:

 

------------------------------------------------

 

"SELECT column1, COUNT(*) AS total FROM backup WHERE StartDate AND EndDate BETWEEN '2006-12-01' AND '2007-12-31' AND column1 = 'Very Good' GROUP BY column1");

 

------------------------------------------------

 

Now I want to count the value "Very Good" in all 3 columns and been Googling since hours without any success. Would appreciate all the help.

 

The second query that I use to count all the group and count the records in a column is:

 

-------------------------------------------------

 

SELECT column1, COUNT(*) AS total FROM backup WHERE StartDate AND EndDate BETWEEN '2006-12-01' AND '2007-12-31' GROUP BY column1 ORDER BY total DESC

 

----------------------------------------------------

 

Now I want to group and count the records in all the 3 columns together but here too I couldn't figure out.

 

Please Help

Link to comment
Share on other sites

       

 

Hi drranch,

 

I don't really know if the code used for Radio Buttons would be of any help as they are working properly. They insert the values into the table. What I now want to do is to read(Count) from the table.

Anyway below is the code used for the Radio Buttons.

_________________________________________

 

<INPUT TYPE=radio NAME="column1" Value="Very Good">

<INPUT TYPE=radio NAME="column1" Value="Good">

<INPUT TYPE=radio NAME="column1" Value="Bad">

<INPUT TYPE=radio NAME="column2" Value="Very Good">

<INPUT TYPE=radio NAME="column2" Value="Good">

<INPUT TYPE=radio NAME="column2" Value="Bad">

<INPUT TYPE=radio NAME="column3" Value="Very Good">

<INPUT TYPE=radio NAME="column3" Value="Good">

<INPUT TYPE=radio NAME="column3" Value="Bad">

<INPUT TYPE=SUBMIT NAME="submit" VALUE="SUBMIT"></FORM>

 

____________________________________________

 

Now these 9 Radio Buttons will insert the 3 Values in 3 different columns. All I want to do is for example to count how many times the value "Very Good" is inserted in all 3 columns. I can count it from 1 column simply with a COUNT statement in my previouse post. I just want to find a way to count it from all three columns at the same time.

 

Link to comment
Share on other sites

If I understand you right you only want to know how to query and count how many times the word "very Good" is in all of the three columns...

 

 

"SELECT column1, column2, columm3, COUNT(*) AS total FROM backup WHERE StartDate AND EndDate BETWEEN '2006-12-01' AND '2007-12-31' AND column1 = 'Very Good' AND column2=Very Good AND column3=Very Good GROUP BY column1")"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.