• I set up a new WP installation and during the setup the database was created and I selected the table prefix.
    I then after the installation was completed, used the PHPMyAdmin to create custom tables for data I need to store.

    I put some custom PHP code on a test page to retrieve data from these custom tables (they have data) but it does not return any info. However, when I query a WP table, the information is retrieved successful.
    Why can I not get any info from the custom tables.
    I read some threads that indicate I have to use some plugin to create the custom tables and cannot create them using the PHPMyAdmin.

    This is the code that does retrieve info from a standard WP table
    xxx is just the replacement of my actual table prefix

    global $wpdb;
    $customers = $wpdb->get_results(“SELECT * FROM xxxusers”);
    echo “<table>”;
    foreach($customers as $customer){
    echo “<tr>”;
    echo “<td>”.$customer->user_login.”</td>”;
    echo “<td>”.$customer->user_email.”</td>”;
    echo “<td>”.$customer->ID.”</td>”;
    echo “</tr>”;
    }
    echo “</table>”;
    ?>

    However, when I replace the table name with my custom table name and the fields in the table, is dies not return any information.
    The custom tables does not have the prefix in front of the table name.
    I have tried adding the prefix to the table name but it still does not return any info.

    Help would be appreciated
    Thanks

  • The topic ‘Custom Data Table’ is closed to new replies.