PHP cannot connect to database
雨木木
雨木木 2018-12-18 11:10:40
0
1
1058

<?php
$conn=mysqli_connect("127.0.0.1","root","root","PJ")or die("Failed to connect to the database! Username or Wrong password!");
mysql_select_db("PJ","$conn");
mysql_query($conn,"CREATE TEMPORMARY TABLE 'MESSAGE'");
?>


Error Warning: mysqli_connect(): (HY000/2002):

雨木木
雨木木

reply all(1)
Peter-Zhu

Are you using mysql or mysqli? These are two different things. Mysqli is an enhanced version of mysqli

What you use to connect is: mysqli_connect(). To select the database later, use The one is: mysql_select_db(), you should also use: mysqli_select_db()

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!