Does any one has a less complicated way of connecting to the Database? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Does any one has a less complicated way of connecting to the Database?

for some reason my code has refused to connect to my Database or produce any error message https://code.sololearn.com/wuBeiXqUSydD/?ref=app

29th Sep 2018, 2:23 AM
Bob
Bob - avatar
6 Answers
+ 9
This is how I connect with the Database using MySQLi: <?php $connection = mysqli_connect('localhost', 'root', ' ', 'my_db'); /* PHP codes here */ ?>
29th Sep 2018, 11:24 AM
ᴰᴼᴹᴵᴺᴼ
ᴰᴼᴹᴵᴺᴼ - avatar
+ 5
Make sure you have input the correct database name, user and password.
29th Sep 2018, 2:34 AM
Calviղ
Calviղ - avatar
+ 4
Put sql connection means table name.
29th Sep 2018, 10:28 AM
R💠🇮🇳
R💠🇮🇳 - avatar
+ 3
Thanks Domino It works fine for me ☺
29th Sep 2018, 1:43 PM
Bob
Bob - avatar
+ 2
Thanks I've done that but it doesn't still connect or give me an error message even when I put the wrong details on purpose is there any easier way to connect to my Database?
29th Sep 2018, 8:44 AM
Bob
Bob - avatar
+ 2
You probably won't be able to connect to any database here on sololearn (even to a non-localhost one) because of security reasons. This is also why you can't send mails with php or use webstorage API with JS.
5th Oct 2018, 2:38 PM
Jan Štěch
Jan Štěch - avatar