Converting WordPress database to simple SQl statements
-
Hi all,
I am trying to find a solution for this and not sure if it’s possible.
Say for example I created a custom post called Employee with custom fields in it like an address field, zip code field, first name & last name field, position, and department. So a admin user can create a post with all that info and it will display it as a post on the site. It will essentially be a employee directory look up so you can see people who work at the company.
Now say I want to take that info from wordpress and create a basic MySql table out of with table fields like address, zip code, first name, etc.. How could I take that info from the wordpress DB and either dump it out as insert statements or something that would make it easier for me to take what ever it outputs and create insert statements to insert into another table which just contains the employee info and no tags or anything like?
So for example I would need to do something like this:
INSERT INTO newTable (address, zip, first name, etc..) VALUES (‘address field data from custom post’, ‘zip code field from custom post’, etc..)The reason I need to do this is because I need to be able to give admin users the ability to create new employees posts from within the wordpress admin area but I also need to be able to create a separate mysql table with the same info but not in wordpress format. Now I am wondering if there is an easy way to do this or would I just have to manually update the separate table whenever a new employee post is created.
Or is there a way to have wordpress save the employee info directly into separate employee table when a new post is made and not save it as a post within its own schema? This way it pulls all the info from that separate table and not where it saves its post data. I would have to create custom queries to display the data on the website but just wondering if that’s possible.
- The topic ‘Converting WordPress database to simple SQl statements’ is closed to new replies.