I have a query that need to get info from two tables as follows:
$query = "SELECT table1.title, table2.item_id, table2.feel, AVG(table2.feel) as avgfeel FROM table1,
table2 WHERE table1.item_id = table2.item_id GROUP BY table2.item_id ORDER BY table2.feel DESC";
$result = mysql_query($query) || die( mysql_error() );
while ($row = mysql_fetch_array($result)) {
$feel = number_format($row[avgfeel], 2);
echo "$row[title] - $feel<br>";
}
I keep getting this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path/to/script.php on line 51
Line 51 is this:
while ($row = mysql_fetch_array($result)) {
Ideas?