About web design | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About web design

How can I connect my php files to my database?

23rd Dec 2017, 2:28 PM
Shivam Mirje
Shivam Mirje - avatar
1 Answer
+ 2
<?php $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"; ?>
23rd Dec 2017, 3:00 PM
Iman Jamaatlou
Iman Jamaatlou - avatar