WordPress.org

Forums

[resolved] Connecting to custom database in wordpress (7 posts)

  1. nimbus3000
    Member
    Posted 1 year ago #

    Hello Everyone,

    Can someone tell me how to connect to a custom table using wordpress?

    What i mean mean is this: i have created a table for adding registered users of my website. i have manually added a few rows of data to this table. now I want to be able to perform operations on this table using my wordpress frontend. My php code on the text section of wordpress page is somehow supressed and i am not able to get the desired output.

    Can someone please help?

    Cheers !

  2. kmessinger
    Forum Moderator
    Posted 1 year ago #

    AFAIK you can have only one database. I don't adding the table will work either. Try looking for a plugin that might work.

  3. kmessinger
    Forum Moderator
    Posted 1 year ago #

    Correction. A search shows you can add a table to the wp database with no problems. There are plugins for that.

  4. nimbus3000
    Member
    Posted 1 year ago #

    Thanks a lot for the reply kmessinger.

    Can you help me with the name of the plugin?
    I have spent a couple of days on the same thing now with nothing much to show for.

  5. kmessinger
    Forum Moderator
    Posted 1 year ago #

    You can use phpMyAdmin and you can do anything to the database you want.

    This plugin might work
    https://wordpress.org/plugins/edit-any-table/

    A google search for plug in for adding tables to wordpress database shows info that might be of help.

    A search here for add+table+to+database also comes up with some information. Any plugin for wp has to have that function so there might be help in info on making plugins.

    Sorry I can't be more specific.

  6. Evan Herman
    Member
    Posted 1 year ago #

    You may want to take a look at the wpdb functions that come with WordPress.

    I have used these to manually add data to a gravity form table with good success in the past. It will look similar to this:

    $wpdb->query(
    	"
    	UPDATE $wpdb->posts
    	SET post_parent = 7
    	WHERE ID = 15
    		AND post_status = 'static'
    	"
    );
  7. nimbus3000
    Member
    Posted 1 year ago #

    Thanks a lot guys.

    Really appreciate the help.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.