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.