rashawn13 Posted February 20, 2010 Share Posted February 20, 2010 function get_mysql_data(){ include'../ipod/configure/db.php'; $item="SELECT * FROM PRODUCTS"; $query=mysql_query($item); echo"<table> <tr>"; while ($items = mysql_fetch_object($query)) { echo'<td><h2>'.$items->name.'</h2> <div class="description"> <span>'.$items->description.'</span> <img src="'.$items->img.'"> <div class="price"> '.$items->price.' </div> <div class="addtocart"> <a href="#">Add to cart </a> </div> </td>'; } } Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/content/r/a/s/rashawn1312/html/ipod/design/templates.php on line 41 <<<< this is the code that appears i would just like to know how to fix the message Link to comment https://forums.phpfreaks.com/topic/192739-what-does-this-error-message-mean/ Share on other sites More sharing options...
sader Posted February 20, 2010 Share Posted February 20, 2010 It means that u are not connected to databse or u have not selected any database to work with or maybe u dont have table called PRODUCTS? mysql_connect(...); mysql_select_db("YOUR_DB_NAME"); //now u can execute mysql queries and fetch results If your ../ipod/configure/db.php looks something like @mysql_connect() or @mysql_select_db() remove @ and see if u get more errors. Link to comment https://forums.phpfreaks.com/topic/192739-what-does-this-error-message-mean/#findComment-1015316 Share on other sites More sharing options...
rashawn13 Posted February 21, 2010 Author Share Posted February 21, 2010 it still does not work Link to comment https://forums.phpfreaks.com/topic/192739-what-does-this-error-message-mean/#findComment-1015722 Share on other sites More sharing options...
PFMaBiSmAd Posted February 21, 2010 Share Posted February 21, 2010 If you echo mysql_error() on the next line right after your mysql_query() statement, it will tell you why the query is failing. Link to comment https://forums.phpfreaks.com/topic/192739-what-does-this-error-message-mean/#findComment-1015725 Share on other sites More sharing options...
sader Posted February 21, 2010 Share Posted February 21, 2010 if u run this SELECT * FROM PRODUCTS in phpMyAdmin do you get any results? Link to comment https://forums.phpfreaks.com/topic/192739-what-does-this-error-message-mean/#findComment-1015742 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.