Wordpress Site - Using Custom PHP and Databases

I finally finished coding the project with an HTML file upload form and a large PHP file that presents a 200 field CSV field to my database. It first loads into a staging table and then splits the data into smaller tables.

This all works fine, but I am having trouble with the next step, which is required to run on a wordpress site that already exists. I have a database just for this project with tables for users, clients, staging, counters, etc. I need all these tables in their own database because these users are separate from WP users.

I found a plugin that allows you to embed PHP into pages, but I need to know how to work with a custom database in WP, I just worked with an actual database. Any help is appreciated.

+3


source to share


2 answers


If you want to use php try this tutorial: https://www.w3schools.com/php/php_ref_mysqli.asp

If you are developing Wordpress plugins check out the Wordpress code: https://codex.wordpress.org/Creating_Tables_with_Plugins



It takes a little research on your part. Good luck!

+3


source


Include the Wordpress dp file in the script 'wp-admin / includes / upgrade.php' and then call

global $wpdb;
$wpdb->query($your_query_string);

      

This way you can use wordpress database. But go through Wordpress once so you know about tables. Since wordpress stores certain data in certain tables, let's say - any user information in the user_meta table.



If you are trying to insert new users, you may need to enter data into the user table.

Another method.

You can open the wordpress theme theme.php then you can write scripts to input your data or whatever you want. And I think this is the best way to work with wordpress.

+3


source







All Articles