Support » Fixing WordPress » Best way to pull from a user-created table?

Viewing 1 replies (of 1 total)
  • skippy

    (@skippy)

    Member

    You’d pull data from your table using the same mechanisms as used with all WordPress functions:
    <?php
    global $table_prefix;
    $mytable = $table_prefix . 'my_table_name';
    $foobar = $wpdb->get_var("SELECT COUNT(id) FROM $wpdb->$mytable WHERE foo='bar'");
    echo $foobar;
    ?>

    See the wpdb class documentation.

Viewing 1 replies (of 1 total)
  • The topic ‘Best way to pull from a user-created table?’ is closed to new replies.