WordPress.org

Ready to get started?Download WordPress

Forums

Problem with creating new db table (3 posts)

  1. carmelneta
    Member
    Posted 1 year ago #

    Hey fox,
    I'm having some issuse when trying to work with a new table on wpdb
    I've created a new table on phpmyadmin, but when trying to pull out data noting comes out:
    table holding one column named "id".

    global $wpdb;
       $nun= $wpdb->get_results(
       "
       SELECT *
       FROM $wpdb->fet_users
       "
        );
      foreach ( $nun $nuna)
        {
          echo $nuna->id;
          echo "<br />";
         }

    Any ideas?
    thanks

  2. Does it give you an error or anything of the kind?

    What does it show if you do:
    var_dump( $nun ); exit; ?

  3. Spencer Cameron
    Member
    Posted 1 year ago #

    For starters, you're missing the as in your foreach.

    Like this:

    foreach( $nun as $nuna ) {
        // Make things happen.
    }

    Was that just a typo when you entered it here or is that in your code? If it is, you should be getting a parsing error and/or a white screen.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags