Support » Plugins » Hacks » table setup with $wpdb

  • Resolved jract7

    (@jract7)



    website is on a localhost now. or I’d have a link… you can visit http://www.rosewoodresources.net to see what I’m working on if needed.

    For the life of me, I can’t figure out why this will NOT create a table. I’ve been digging and posting for 4 days and not a friggen thing has worked… CAN SOMEONE PLEASE HELP ME OUT!!!! What in the world am I missing here?
    I’m creating this for a plugin… all the code seems correct. I’ve gotta be missing something so simple…

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I’ve used global $wpdb; out of the function, I’ve tried ten different ways write the damn thing including using a query instead of the required_once. I’ve tried on a localhost with every php/mysql updated…I can’t find the table at all…

    I would be very very greatful for some help here… I’m about to pull my hair out.

    Here is also a function that keeps returning “table not found”

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 3 replies - 1 through 3 (of 3 total)
  • did you try echoing the vars to check if they’re right at runtime?

    Yeah, if you are referring to: $jsa_user_name, $jsa_post_title… it echos the user’s login name and post title correctly…
    Then I query on another page with:

    global $wpdb;
    $table_name = $wpdb->prefix . "jsadb";
    		foreach( $wpdb->get_results("SELECT * FROM '$table_name'") as $key => $row)
    		{
    			$my_column = $row->column_name;
    		}

    just to check and nothing shows up…so I added this to make sure the table is there:
    if($wpdb->get_var("show tables like '$table_name'") != $table_name)
    and it never finds the table…
    So I guess its not being created or I’m insert and get_results completely wrong… but per all the examples, i don’t see a problem anywhere. lol, or I’ve stared at it so long I’ve over looked something.

    …this is the code…

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘table setup with $wpdb’ is closed to new replies.