Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WordPress - Add database tables

Posted on 2015-02-08
4
Medium Priority
?
96 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 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 400 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 1600 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you are looking for plug-ins to add functions to your WordPress small business web site, take some time to read though this comprehensive list.  These are all the plugins I use for my customers WordPress web sites, as well as my own.  Be sure to …
In Part I (http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_8410-Getting-Started-In-WordPress-Part-I.html), I introduced you to the powerful WordPress backend, the WordPress administrative Dashboard.  In Part II, I will introduce yo…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…

877 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