I am new to PHP and cant seem to get this to work.
My query is working in the Mysql console but the query keeps dying when I try to use it in the code.
$query = "SELECT names.webname AS webnames, avg(vote.user_vote) AS votes FROM names" .
"LEFT OUTER JOIN vote USING (id)" .
"GROUP BY webnames";
$result = mysqli_query($dbc,$query) or die('Query Error');
echo '<table>';
while ($row = mysqli_fetch_array($result)) {
echo '<tr><td>' . $row['webnames'] . '</td></tr>';
if(isset($row['votes'])){
echo $row['votes'];
}
}
echo '</table>';
Thanks,
Sfoot