how can I separate values returned from a query or is that even possible?
What I am trying to do is do is $query = "SELECT * FROM whitealbumreg.lps";
lps has a column called lp_origin. lp_origin is ENUM where values are either US or UK. I know how to pull them out of the database individually (like WHERE lp_origin = "us") and together (like SELECT * FROM colname"), but I am not sure how to pull them out together and then separate them.
My goal is to run numbers based on # of registered lps from US vs. UK.
I assume that once I know how to do that I can do all sorts of math like % of male to female members, or % registered UK mono to stereo copies, etc.
Unfortunately, this is how I achieved it. I have some enums with 6 choices. There has to be a way to pull them all out and seperate them later, rather than doing writing code to pull each one out at a time. There has to be a better (read: more efficient) way:
$query1 = "SELECT * FROM whitealbumreg.members";
$result1 = mysqli_query($dbc, $query1)
or die('Error querying database.');
$query2 = "SELECT * FROM whitealbumreg.lps WHERE lp_origin='uk'";
$result2 = mysqli_query($dbc, $query2)
or die('Error querying database.');
$query3 = "SELECT * FROM whitealbumreg.lps WHERE lp_origin='us'";
$result3 = mysqli_query($dbc, $query3)
or die('Error querying database.');
$query4 = "SELECT * FROM whitealbumreg.members WHERE member_gender='m'";
$result4 = mysqli_query($dbc, $query4)
or die('Error querying database.');
$query5 = "SELECT * FROM whitealbumreg.members WHERE member_gender='f'";
$result5 = mysqli_query($dbc, $query5)
or die('Error querying database.');
$members = mysqli_num_rows($result1);
$uk = mysqli_num_rows($result2);
$us = mysqli_num_rows($result3);
$m = mysqli_num_rows($result4);
$f = mysqli_num_rows($result5);
echo '<br />';
echo '<table width="400" border="1" cellpadding="2">';
echo '<tr><td>Percent of registered albums from the UK:</td><td>';
echo ($uk / $members) * 100;
echo '</td></tr>';
echo '<tr><td>Percent of registered albums from the US:</td><td>';
echo ($us / $members) * 100;
echo '</td></tr>';
echo '<tr><td>Percent of male members:</td><td>';
echo ($m / $members) * 100;
echo '</td></tr>';
echo '<tr><td>Percent of female members:</td><td>';
echo ($f / $members) * 100;
echo '</td></tr>';
echo '</table>';