0
votes

How to resolve this warning which is shown when I use "custom tables" plugin for Wordpress? Can anybody help me please

Warning: Invalid argument supplied for foreach() in ..\wp-content\plugins\custom-tables\pages\show_table.php on line 378

URL of this plugin http://wordpress.org/extend/plugins/custom-tables/

1
This error most probably occured if the table is empty. wordpress.org/support/plugin/custom-tables is the official support for the plugin. - RRikesh
but my table is not empty no help given on this official support - Waqas Farooqi

1 Answers

1
votes

The Invalid argument supplied for foreach() is obtained when the element pased in the foreach() is not an array. For this plugin, at line 378:

foreach ($qry as $row) {

You can test if it is an array before passing through the foreach loop:

if ( is_array($qry ))
{
  foreach ($qry as $row) {...}
}
else die('not an array');

However, I encourage you to ask from the plugin support forum. The author can fix the plugin (assuming it's a problem with the plugin itself). Modifying the core of a plugin yourself is not advisable and consequently updating that plugin will overwrite your changes.