0
how to connect php to my sql
3 ответов
+ 2
$conn = new mysqli("servername ", "user_name","password");
// check connection
if($conn->connect_error){
die("conection fail" . $conn->connect_error);
}
// here is server name is your server name example is localhost , user_name is your database user name , password is your database password
+ 1
The mysqli functions are soon-to-be outdated. Sqlsrv is the alternative suggested by php.net (http://php.net/manual/en/book.sqlsrv.php)
Read more about the topic there.
0
STOP mysqli connect
use PDO because is more secure
look PDO contruct on php.net