help me connect database | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

help me connect database

hello sololearner this is my first time i'm trying to connect database with my php page. i tried however i failed i'm not using wamp or xamp i'm using hosting so please check wheter 1. SERVER NAME IS WRONG 2. OR OTHER MISTAKE I DID 3. GIVEN BELOW IS MY CODE <?php $servername = "sql205.epizy.com"; $username = ""; $password = ""; $dbname="epiz_24380269_data_base"; // Create connection $conn = mysqli_connect($servername, $username, $password,$dbname); // Check connection if ($conn) { echo"true"; } echo "false"; ?> IF MY SERVER NAME IS WRONG PLEASE TELL ME HOW CAN I FIND RIGHT SERVER NAME

13th Oct 2019, 1:50 PM
Najmuddin Ansari
Najmuddin Ansari - avatar
7 Answers
+ 4
THE HOST PROVIDE YOU WITH THE SERVERNAME, USERNAME, AND PASSWORD. CHECK ON YOUR DATABASE IN CPANEL also, dont post those information in public, its easy for people to mess up your database if we know how to get in.
13th Oct 2019, 2:10 PM
Taste
Taste - avatar
+ 3
Please remove other words from Relevant Tags except for SQL PHP and MySQL ๐Ÿ‘ (Edit) Tags edited by moderator. Thanks @Tashi N ๐Ÿ˜๐Ÿ‘
13th Oct 2019, 2:55 PM
Ipang
+ 2
btw you can print the error message if its failed either mysqli_connect_error()ย for connection error or mysqli_error(). its much easier to find the exact error
13th Oct 2019, 2:51 PM
Taste
Taste - avatar
+ 1
Taste thanks for the answer i know this server etc should be confidential thats why i create this free hosting only for practice bro๐Ÿ˜Š
13th Oct 2019, 2:47 PM
Najmuddin Ansari
Najmuddin Ansari - avatar
+ 1
Terdoo - Toheeb Osu its ok bro now problem has been sort out ๐Ÿ˜Š๐Ÿ‘
14th Oct 2019, 4:46 PM
Najmuddin Ansari
Najmuddin Ansari - avatar
+ 1
Use object oriented
15th Oct 2019, 9:44 AM
Bizhan Hejazi
Bizhan Hejazi - avatar
0
I would love to help you but my programming database language is SQL
14th Oct 2019, 4:38 PM
Terdoo - Toheeb Osu
Terdoo - Toheeb Osu - avatar