toddtwiddy Posted June 7, 2012 Share Posted June 7, 2012 <?php $query = "select * from items"; $result = mysql_query($query); while ($row = mysql_fetch_row($result)) { ?> <tr> <td> <?= $row['name']?> </td> </tr> <?php } ?> This is the error I'm getting and I just can't figure out why? Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/content/65/9110965/html/index.php on line 77 Link to comment https://forums.phpfreaks.com/topic/263836-can-anyone-tell-me-why-this-shouldnt-work/ Share on other sites More sharing options...
Pikachu2000 Posted June 7, 2012 Share Posted June 7, 2012 When posting code, enclose it within the forum's . . . BBCode tags. Do you ever establish a connection to the database in the code? Link to comment https://forums.phpfreaks.com/topic/263836-can-anyone-tell-me-why-this-shouldnt-work/#findComment-1352020 Share on other sites More sharing options...
scootstah Posted June 7, 2012 Share Posted June 7, 2012 Try: $result = mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/263836-can-anyone-tell-me-why-this-shouldnt-work/#findComment-1352021 Share on other sites More sharing options...
toddtwiddy Posted June 7, 2012 Author Share Posted June 7, 2012 OMG I am such a friggin MORON!!!!! dunno why but I didn't select the db, only made a connection to the server :shrug: :shrug: Link to comment https://forums.phpfreaks.com/topic/263836-can-anyone-tell-me-why-this-shouldnt-work/#findComment-1352026 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.