Friday, 15 April 2011

php - $wpdb in the plugin, admin pages working but not the shortcodes -



php - $wpdb in the plugin, admin pages working but not the shortcodes -

i developing plugin, have queries admin office , working when re-create them , paste function create short-code query not working anymore.

i have working code here this:

function test(){ include ($_server["document_root"]."/test.php"); }

and when set same code not working anymore:

function test_shortcode(){ include ($_server["document_root"]."/test_shortcode.php"); } add_shortcode( 'test_shortcode', 'test_shortcode' );

i appreciate suggestion, can not understand why not working. if utilize mysql_connect working in both functions, when utilize wordpress function $wpdb working in first function not in function short code.

my loop same in both files:

global $wpdb; $table_name = $wpdb->prefix . "table_name"; $result = $wpdb->get_results( "select * $table_name"); foreach($result $raw){ echo $raw->il_date }

php wordpress

No comments:

Post a Comment