Page is a not externally linkable
- Code, Content, and Presentation
-- WordPress
---- while loop produces errors in db data retrieval


surrealillusions - 2:14 pm on Sep 17, 2012 (gmt 0)


Having a bit of trouble in getting data from a couple of custom database tables.

This error is produced:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in <url> on line 19


$qry = "SELECT *
FROM wp_customtable";
$data = mysql_query($qry);
while($row = mysql_fetch_array($data,MYSQL_ASSOC)) {
// a whole bunch of stuff dealing with the data
}


Trying a foreach loop doesnt produce any errors, but also produces no data.

I've tried numerous bits of code from around the code but with no success.

How do you get the while loop to work within wordpress?

All this code is within a custom page template, no plugins used for this.


Thread source:: http://www.webmasterworld.com/wordpress/4496264.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com