Thanks for all who can help me and offer help.. it is really appreciated
I have to get this done tonight, and i'm just stuck.
I need to be able to display the results of a survey and display them in a well formed table. (i.e. pretty)
I'm relatively new to this.
I can submit the results to a db and i can read the results of each individual row and show them in a table, but i can add up the total of a certain word from an individual column/row
(i.e. column is called pub_priv and submissions included either 'private' or "public")
I need to know who to display the total amount of submissions that included public or private (or any other word in the survey and survey and display it as one would display a poll
(i.e. Public - 201 %50 Private - 201 %50
and then show them along with their question.
TO get an idea of what this means, here is a link to the survey
survey
Here is my code. (temporary password included)
this one reports that the entry was submitted (survey is not submitting everything yet
<?php
error_reporting(E_ALL ^ E_NOTICE);
$db = mysql_connect("localhost","reforumc_temp","temp1234");
mysql_select_db ("reforumc_email");
$query = "INSERT INTO equinoxsurvery(id, pub_priv, size, scope, position, entrepreneur, more_entrep, percieve, attracted, entrep_approach, met, screens, behave, rewarded, offers, function)
VALUES('".$_POST['id']."','".$_POST['pub_priv']."',
'".$_POST['size']."','".$_POST['scope']."',
'".$_POST['position']."',
'".$_POST['entrepreneur']."',
'".$_POST['more_entrep']."',
'".$_POST['percieve']."',
'".$_POST['attracted']."',
'".$_POST['entrep_approach']."',
'".$_POST['met']."',
'".$_POST['screens']."',
'".$_POST['behave']."',
'".$_POST['rewarded']."',
'".$_POST['offers']."',
'".$_POST['function']."')";
$result = mysql_query($query);
echo "Thank you for taking our survey."; ?>
THis displays each row that has been submitted.
<?php
$connection = mysql_connect ("localhost","reforumc_temp","temp1234") or die('Database not available');
mysql_select_db('reforumc_email');
$query = "SELECT * FROM equinoxsurvery";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
// echo "<table border=1>";
//echo "<tr><td><b>Full Name</b></td><td> <b>Email Address</b></td></tr>";
while($row = mysql_fetch_assoc($result)) {
$question0 = $row["id"];
$question1 = $row["pub_priv"];
$question2 = $row["size"];
$question3 = $row["scope"];
echo "<table border=1>";
echo "<tr colspan=4><td>$question0</td>
<td>$question1</td>
<td bgcolor=#E8EFF7>$question2</td>
<td>$question3</td></tr>";
echo "</table>";
}
}
else {
echo 'No rows';
}
mysql_close ();
?>
EDIT!!! this is the code that is supposed to give me the total
<?php
$sql = "SELECT count(*) FROM equinoxsurvery WHERE pub_priv ='private'";
$result = mysql_query($query) or die(mysql_error());
$private_comp = $result1[0];
$sql = "SELECT count(*) FROM equinoxsurvery WHERE pub_priv ='public'";
$result = mysql_query($query) or die(mysql_error());
$public_comp = $result[0];
?>
this was given to me by someone at the sitepoint forums. but i did not know how to pull the content.