+ 1

How should I link my php file to my database?

8th Nov 2016, 5:08 PM
Sachin Burnawal
Sachin Burnawal - avatar
2 Answers
+ 7
use $servername = "localhost"; $username = "username"; $password = "password"; // Create connection $conn = new mysqli($servername, $username, $password); // Check connection if ($conn->connect_error) {     die("Connection failed: " . $conn->connect_error); }  echo "Connected successfully";
8th Nov 2016, 5:37 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
- 2
mysql-connect('localhost','root,'');
10th Nov 2016, 4:45 AM
Mohammad Bilal
Mohammad Bilal - avatar