Dreamer Posted March 4, 2004 Share Posted March 4, 2004 Hi ya all, im a total newbiew so please do try to help; i'm trying to do a simple online questionaire. Basically there is a question and two choices, with 'yes' or 'no', and now I need my survey to be able to count the number of 'yes' or 'no' that people have voted. So i have a simple mysql table with the question and the two choice (i will have more choices 1ce i get these working). The 'yes' or 'no' option should either be radio or check buttons, which i'm doing in dreameweaver in a form. How can i get record the numbe of votes for each options? is it a count function in php or incremento-both of which i do not kno whow to do. please provide a simple working e,g and once the votes/survey has taken place the results should be displayed? please help if you know it in any otehr methods please give a working e.g thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/1721-please-help-simpe-q-passing-button-info-to-db/ Share on other sites More sharing options...
jvrothjr Posted March 4, 2004 Share Posted March 4, 2004 Where are two ways I have used to count records $result1 = mysql_query ("Select fldnm from tblnm where fldnm = '$Value' "); $num1 = mysql_num_rows($result1); $result=mysql_query("select count(*) from tblnm where fldnm = '$value'"); $total=mysql_result($result,0,"count(*)"); Hope this helps a little. Quote Link to comment https://forums.phpfreaks.com/topic/1721-please-help-simpe-q-passing-button-info-to-db/#findComment-5596 Share on other sites More sharing options...
Dreamer Posted March 4, 2004 Author Share Posted March 4, 2004 hmmm i'm a newbiew dude, whats the value for? Quote Link to comment https://forums.phpfreaks.com/topic/1721-please-help-simpe-q-passing-button-info-to-db/#findComment-5598 Share on other sites More sharing options...
jvrothjr Posted March 5, 2004 Share Posted March 5, 2004 if you have a field in a table your are going to compair the 'VALUE' of whats in that field. The 'VALUE' is the query is what your searching for. If the field options are 'YES' or 'NO' then the value with be what your looking for to count. If you have a checkbox field in general the values with be 0 or 1 Quote Link to comment https://forums.phpfreaks.com/topic/1721-please-help-simpe-q-passing-button-info-to-db/#findComment-5604 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.