I have finally finished coding a project with an HTML form for file upload, and a large PHP file that submits a 200 field CSV into my database. It first uploads to a staging table and then splits the data into smaller tables. This all works perfectly but I'm having problems with the next step: This is needed to run on a wordpress site that already exists. I have a database just for this project with tables for users, clients, staging, meters, etc. I need all of these tables in their own database because these users are separate from the WP users. I found a plugin that allows you to insert PHP into pages, but I need to know how to work with a custom database in WP, I've only ever worked with the actual database. Any help is greatly appreciated.

  • Rather than inserting PHP into pages, it would be safer to create your own theme, with template PHP files which perform the necessary operations.
    – WebElaine
    Commented Mar 29, 2017 at 14:46
  • Yes, I definitely realize it can be a security issue to insert the PHP, but this was just for a testable project so I wasn't as concerned with that aspect. I was more curious about how to integrate a custom db table with the existing theme
    – H.Norman
    Commented Mar 29, 2017 at 14:50
  • 1
    If you're inserting the PHP directly into the content it's not really a WordPress-specific question. You can just use mysqli_connect as in any PHP. If instead you'd like to do things a safer, more standard way, you'd perform the same function within theme templates - or perhaps in a plugin that you call using shortcodes.
    – WebElaine
    Commented Mar 29, 2017 at 15:34

1 Answer 1


Since we do not know how the data should be represented on the 'front-end' (read WP install), it is hard to say.

I've tried to provide some ideas how to combine WordPress and 3rd party content. This list can probably a bit longer, but these would be the obvious ones. If you could give us a bit more insight to about what data your handling, that would make it tonnes easier to assess and give you an idea to handle it.

I've also added a few links to the WordPress Codex. It contains all the necessary explanations and code examples you need.

(1) Small Google Search
(2) Third result on Google
(3) First result on Google

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.