Solved

WordPress - Add database tables

Posted on 2015-02-08
4
85 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Did you use a default hosting installation of wordpress with the intention of it being your actual site?  Maybe you’ve installed it as a Blog to your current site and recently converted it to be the main site and do away with the old .htm pages.  An…
Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

759 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