You’d use the wpdb class to access your database.
Sir, That’s the problem I don’t know how to do it
private $servername = “localhost”;
private $username = “xxx”;
private $password = “xxx”;
private $dbname=”xxx”;
Can you type code I will replace with this .
No, I can’t, because it would only be a small part of a much larger plugin. If you need custom coding, you need to hire someone. We recommend jobs.wordpress.net; do not accept any offers from people who post here, and be sure to check out references for anyone you might want to hire.
site/db.php
site/user/db.php
site/wp-content/plugins/hero/index.php
I need that code in these files
no,you do not. You set your wp database info in only ONE place, wp-config.php.
I think sir you not understand
Read this
site/db.php
site/user/db.php
site/wp-content/plugins/hero/index.php
These are files required belew code
private $servername = “localhost”;
private $username = “xxx”;
private $password = “xxx”;
private $dbname=”xxx”;
I am doing it manually by cpanel
I want this code connect to wp-config.php
Database details
So me not need to do it manually
I don’t think you understand how WordPress works. If you want to integrate something with WordPress, you’d write a plugin. You do not go around edit PHP files directly.
You’re asking about how to develop a plugin. See https://developer.wordpress.org/plugins/
Please tell me what you are really trying to accomplish instead of asking about the database.