I'm trying to output a percentage, but when I run this code all I get is a blank screen. I know there's errors somewhere so if somebody could point them out to me it would be great thanks!
<html>
<body>
<?php
$con = mysql_connect("mysql360int.cp.blacknight.com","u1041802_ahunty","andrew23");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db1041802_buyer1", $con);
$query1="Select COUNT(rate) AS PositiveRating FROM feedback WHERE rate
= 'positive'";
$result1 =mysql_query($query1);
if(mysql_num_rows($result1))
{
while($row = mysql_fetch_assoc($result1))
{
$PositiveRating = $row['PositiveRating'] ;
/echo ("$PositiveRating");/
}
}
else
{
echo "<p>No matches were found in the database for your query.</p>\n";
}
$query="Select COUNT(rate) AS NegativeRating FROM feedback WHERE rate
= 'negative'";
$result =mysql_query($query);
echo "<br/>";
if(mysql_num_rows($result))
{
while($row = mysql_fetch_assoc($result))
{
$NegativeRating = $row['NegativeRating'] ;
/echo ("$NegativeRating");/
}
}
else
{
echo "<p>No matches were found in the database for your query.</p>\n";
}
function percent($result1, $result) {
$num_total = $result1 + $result;
$count1 = $result1 / $num_total;
$count2 = $count1 * 100;
return $count2;
}
echo $count2;
if (!mysql_query($query,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con)
?>
</body>
</html>