0

how to connect php to my sql

23rd Jul 2016, 7:27 AM
aravind
aravind - avatar
3 Réponses
+ 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
23rd Jul 2016, 7:57 AM
Dibya Krushna Das
Dibya Krushna Das - avatar
+ 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.
24th Jul 2016, 10:25 AM
Tor-Salve Dalsgaard
Tor-Salve Dalsgaard - avatar
0
STOP mysqli connect use PDO because is more secure look PDO contruct on php.net
4th Aug 2016, 11:07 AM
francis