Quote:
Originally Posted by Chips Ahoy
You can do all that with your SELECT.
SELECT personname, (SUM(col3) / SUM(col2)) AS calcname FROM table
GROUP BY personname;
So read on SQL.
chips, im reading up on this now.
given this code:
[php]
// Get a specific result
$query = "SELECT * FROM table WHERE name <> ' ' ";
$result = mysql_query($query) or die(mysql_error());
// Print out the contents of each row
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "['".$row['name']."',".$row['number'].",".$row['number2']."],";
}[/php]
and assume i have multiple names and i want to have a name and a percentage for each name as we talked about.
so i do the query using select and the sum as you said. does that do it for all names or just one name?
like will the array become
name %
name %
name %
or just
name %
(the code above says number and number 2, i think thats wrong but im not at that point yet)