Solved

WordPress - Add database tables

Posted on 2015-02-08
4
80 Views
Last Modified: 2015-02-09
I've sort of gotten the impression that I can add custom tables to the WordPress database that I could use for my own purposes.

Is that true?

If so, how do I do that?

And, how do I get access to the database connection info so I can do custom php to manipulate that data.
0
Comment
Question by:Richard Korts
  • 2
4 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 100 total points
ID: 40597484
WordPress just uses a MySQL database.  You can add whatever you want.  Since Wordpress accesses the database for every page, the connection will probably be open already.  Just look thru the Wordpress code to see how they are doing it and then copy it for your own use.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40597563
This really sounds like it could be going in one of two directions.  Are you talking about adding tables and CRUD by creating custom WordPress code via their functions or as a plugin or simply adding more tables in the same mysql database housing WordPress and querying them in?  Both are possible, but the answer changes a bit depending on what you want to do.

In both cases, you will be leaning on the wpdb class as a shortcut, though:

http://codex.wordpress.org/Class_Reference/wpdb
0
 

Author Comment

by:Richard Korts
ID: 40599057
To All,

I'm gathering that I can open the wp database using phpMyadmin on the server, then add tables, etc.

Is that correct?

Can I use a DIFFERENT database that contains my own data ONLY?
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 400 total points
ID: 40599070
I'm gathering that I can open the wp database using phpMyadmin on the server, then add tables, etc.

Is that correct?

Yes.

Can I use a DIFFERENT database that contains my own data ONLY?

Also yes, you would just need to use a different set of connection functions to connect to both it and the WordPress instance at the same time.  I tend to think that's overthinking the problem...you're already connected to the WordPress database by default, just stick the new tables in there and call it a day.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

WordPress is constantly evolving, and with each evolution appears to get better and better.  One of the big drawbacks prior to version 3 was that there was no way to be able to set up a custom menu from the backend. The Old Way Adding menus is…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now