For help, PHP has just migrated the website about database connection errors and checked the index of the root directory. php displays the database connection file code // database class require_once ('class/dbconfig. php '); require_once ('class/class_user.php'); r help, PHP database connection error
After migrating the website, I checked the index. php in the root directory to display the database connection file code.
// Database class
Require_once ('class/dbconfig. php ');
Require_once ('class/class_user.php ');
Require_once ('class/class_public.php ');
Require_once ('class/class_shop.php ');
Open the class/dbconfig. php file. the code is
PHP code
Class dbconfig {// connect to the database function con () {$ con = mysql_connect ('2017. 0.0.1 ', 'root', '123'); mysql_select_db ("database_591", $ con); return $ con;} // run the SQL function getRs ($ SQL, $ con) {mysql_query ('set names utf8'); return mysql_query ($ SQL, $ con);} // run the SQL statement without returning the function deff_getRs ($ SQL, $ con) {mysql_unbuffered_query ('set names utf8'); return mysql_unbuffered_query ($ SQL, $ con);} // Close the dataset function c LearRS ($ rs) {mysql_free_result ($ rs);} // closes the database function clearDB ($ con) {mysql_close ($ con );} // function rsRows ($ rs) {return mysql_num_rows ($ rs);} // dataset pointer function rsSeek ($ rs, $ n = 0) {return mysql_data_seek ($ rs, $ n) ;}}$ db = new dbconfig;?>
Only 123456 is changed to your database password.
But I still cannot connect to the database website. I cannot open other related database files, and I can't change it or I can't. what's the problem? new to PHP? thank you for your advice.
------ Solution --------------------
The directory name is _ 519.
Then the database name is _ 519.
Mysql_select_db ("_ 591", $ con );