Support » Plugins and Hacks » Using $wpdb in plugin – how to show results in page?

Using $wpdb in plugin – how to show results in page?

  • I am trying to work with data that is in a table, and extract it into my wordpress page.

    What I have done is to create a table called ‘wp_axleaa’ in my wordpress database. I am trying to query this table and the only result I get printed is “Array”

    I wrote a plugin as follows:

     * @package Trying to Connect
     * @version 1.6
    Plugin Name: Trying to Connect
    Plugin URI:
    Description: Connecting to DB with $wpdb
    Author: Paul J
    Version: 1.0
    Author URI:
    function tc_info() {
    global $display;
    global $wpdb;
    $display = $wpdb->get_results(
    	SELECT *
    	FROM $wpdb->wp_axleaa
    print $display;

    Then I put the shortcode [showinfo] into my wordpress site, and when I view the page then it just shows “Array”. If I add a WHERE clause to the SQL statement, then I get an error message on the page.

    I am very new to wordpress and writing php and would really appreciate any help.

    Thanks very much,

  • The topic ‘Using $wpdb in plugin – how to show results in page?’ is closed to new replies.