PHP configures mysql and how to test the successful configuration of the database_PHP tutorial

WBOY
Release: 2016-07-13 17:06:01
Original
948 people have browsed it

PHP configuration mysql and how to test the success of configuring the database. Friends in need can refer to it.

If you are configuring php mysql apache for the first time, how do we test whether php connects to the database successfully? Just create a test.php file and save the following code to the file.

If it prompts that the mysql_connect function is not defined, we can configure it in php.ini as shown below
The code is as follows
 代码如下 复制代码

$link=mysql_connect("localhost","root","12345"); //12345改成你的mysql密码
if(!$link) echo "失败!";
else echo "成功!";
mysql_close();
?>

Copy code

$link=mysql_connect("localhost","root","12345"); //Change 12345 to your mysql password

if(!$link) echo "Failed!";

else echo "Success!";

mysql_close();

?>


Open http://localhost/test.php in the browser


If you enter

Success means your configuration is successful. If it fails, we can use mysql_connect("localhost","root","12345") or die( mysql_error()); and there will be an error message.

;extension=php_mysql.dll ;extension=php_mysqli.dll

Remove the previous;extension=php_mysql.dll extension=php_mysqli.dll Then restart apache
http://www.bkjia.com/PHPjc/630737.htmlwww.bkjia.com
truehttp: //www.bkjia.com/PHPjc/630737.htmlTechArticlePHP configuration mysql and how to test the successful configuration of the database. Friends in need can refer to it. If you are configuring php mysql apache for the first time, how do we test that php successfully connects to the database...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!