WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to resolve this warning which is shown when I use the Custom Tables plugin? Can anybody help me please

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

share|improve this question
-1: Your question is leaning on too localized; you refused an edit that made it less so; you have not accepted any answers – shea Feb 1 '13 at 8:02
up vote 0 down vote accepted

A quick and dirty "fix" would be to change line 378 in that file and cast the $qry variable to an array. It should make the error go away, however, to fix the actual cause of the problem some refactoring may need to be done. You could drop the plugin author a note.

foreach ($qry as $row) {
// becomes:
foreach ((array) $qry as $row) {
share|improve this answer
thanx man its working :) – Waqas Farooqi Nov 7 '12 at 11:11
If his hack works for you accept his answer! – shea Feb 1 '13 at 8:04

Try this:

  1. Login to your WordPress admin and visit the Plugins > Editor page
  2. Select Custom tables from the drop-down list
  3. Select the show_tables.php file from the right-hand panel.
  4. Scroll down until you see this line: $qry = $wpdb->get_results($abfrage);
  5. Change that line to: $qry = $wpdb->get_results($abfrage, ARRAY_A);

I can't guarantee that doing this will work; I haven't tested it myself just yet. I'll edit this answer when I have. Post a comment below if you cannot complete one of steps above, for whatever reason.

share|improve this answer
i tried it but not working :( – Waqas Farooqi Nov 7 '12 at 6:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.