Support » Plugins » Undefined variable: wpdb

  • Resolved robdunne

    (@robdunne)


    Hello,

    I’m writing a plugin and trying to request some data from a custom table in my database using:

    $current_text = $wpdb->get_results("SELECT text FROM addtext ORDER BY id DESC LIMIT 1");

    but just get the error Undefined variable: wpdb

    Any idea why this isn’t working? I’ve follow the docs and scoured Google, with no luck. Still pretty new to WP plugins so probably something obvious.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined variable: wpdb’ is closed to new replies.