Anwar11 Posted December 3, 2013 Share Posted December 3, 2013 got error in this line :/ $sql = "SELECT * FROM product-categories"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) <-- ( error in this line ) :/ { echo "<tr><td><font color=blue>"; echo "<a href=Items.php?id=".$row['id'].">".$row['id'] . " " . $row['name']. "</a>"; echo "</td></tr>"; } please help Link to comment https://forums.phpfreaks.com/topic/284496-warning-mysql_fetch_array-expects-parameter-1-to-be-resource/ Share on other sites More sharing options...
QuickOldCar Posted December 4, 2013 Share Posted December 4, 2013 Use backticks to escape that dash $sql = "SELECT * FROM `product-categories`"; Link to comment https://forums.phpfreaks.com/topic/284496-warning-mysql_fetch_array-expects-parameter-1-to-be-resource/#findComment-1461161 Share on other sites More sharing options...
mike12255 Posted December 4, 2013 Share Posted December 4, 2013 The above solution will work. It is best practice to use underscores ( _ ) rather then dashes for mysqli table names Link to comment https://forums.phpfreaks.com/topic/284496-warning-mysql_fetch_array-expects-parameter-1-to-be-resource/#findComment-1461162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.