Home > Backend Development > PHP Tutorial > ,PHP关于数据库连接出错有关问题

,PHP关于数据库连接出错有关问题

WBOY
Release: 2016-06-13 10:22:01
Original
912 people have browsed it

求助,PHP关于数据库连接出错问题
刚把网站迁移过来,看下了根目录的index.php 显示 数据库连接文件的代码
//数据库类
require_once('class/dbconfig.php');
require_once('class/class_user.php');
require_once('class/class_public.php');
require_once('class/class_shop.php');

打开class/dbconfig.php 这个文件 代码是

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->class dbconfig {                //连接数据库        function con()        {            $con = mysql_connect('127.0.0.1', 'root', '123456');                        mysql_select_db("database_591", $con);                        return $con;                    }                //执行SQL        function getRs($sql,$con)        {            mysql_query('set names utf8');                        return mysql_query($sql, $con);                    }                //执行SQL,不返回值        function deff_getRs($sql,$con)         {            mysql_unbuffered_query('set names utf8');                        return mysql_unbuffered_query($sql, $con);                    }                //关闭数据集        function clearRS($rs) {            mysql_free_result($rs);                    }                //关闭数据库        function clearDB($con) {            mysql_close($con);                    }                //数据集条数        function rsRows($rs) {            return mysql_num_rows($rs);                    }                //数据集指针        function rsSeek($rs, $n = 0 ) {            return mysql_data_seek($rs, $n);                    }            }        $db = new dbconfig;?>
Copy after login


只把123456 改成了 自己的数据库密码

但还是连接不上数据库 网站打不开 其他相关的数据库文件 也一样改过 还是不行 请问是什么问题呢 PHP新手 谢谢指教

------解决方案--------------------
目录名是是 _519
那么数据库名就是 _519

mysql_select_db("_591", $con);
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template