+ 2

How to connect to database in php7?

I can connect with the server but can't connect with mysql database. Could anyone share the syntax?

6th Apr 2018, 9:40 AM
Akib
Akib - avatar
9 Answers
+ 8
mysqli_connect( host, login, pass, db );
6th Apr 2018, 10:00 AM
Сергей Луньков
Сергей Луньков - avatar
+ 6
Google will help!
6th Apr 2018, 9:47 AM
Apple 🍏🇺🇿
Apple 🍏🇺🇿 - avatar
+ 3
Xan mysql unavailable in 7 version. I offered MySQLi.
6th Apr 2018, 11:01 AM
Сергей Луньков
Сергей Луньков - avatar
+ 3
perhaps, but those who used mysql , more convenient to use the mysqli module
6th Apr 2018, 12:23 PM
Сергей Луньков
Сергей Луньков - avatar
6th Apr 2018, 11:12 AM
Emma
+ 2
Xan I agree. beginners can PDO
6th Apr 2018, 12:30 PM
Сергей Луньков
Сергей Луньков - avatar
+ 1
Use PDO, not mysql_connect(). http://php.net/manual/en/book.pdo.php
6th Apr 2018, 10:42 AM
Emma
+ 1
True. However, a beginner might as well start learning PDO which works for any database system. It helps them learn a skill that is more prevalent and future proof. It's also a better system.
6th Apr 2018, 12:27 PM
Emma
+ 1
Refer to W3school.com and tutorialspoint.com as both are great resources for this topic.
7th Apr 2018, 4:11 PM
Earl Hansen