php - Wordpress $wpdb->get_results not returning anything -
i'm looking pull out array of option names wordpress database of test site setup i'm running in debug mode. once i've got part of functionality down intend use expand upon plugin built.
so far in searching here , on wordpress.org seems below code should working isn't:
global $wpdb; $table_name = $wpdb->prefix . "options"; $sql = "select `option_name` " . $table_name . " `option_name` '%domain_%'"; $doms = $wpdb->get_results($sql, array_n); foreach($doms $dom){ echo $dom; }
every time run above code following errors:
notice: undefined variable: doms in /sitepath/test.php on line 38
warning: invalid argument supplied foreach() in /sitepath/test.php on line 38
i have several items in option_name column of options table fit query criteria , query works fine in mysql.
what missing here?
Comments
Post a Comment