Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 –  bungeshea Feb 1 '13 at 8:02

2 Answers 2

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! –  bungeshea 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

 
discard

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.