+ 6

What is the best and latest way to make connection to your database in PHP?

I am learning PHP and I have seen different ways of making connection to your MySQL database. Which method is the best and acceptable on php 7?

16th May 2017, 12:18 PM
Grace_Coder
Grace_Coder - avatar
12 Answers
+ 1
You can use mysqli or pdo, but you have to know mysqli only works for mysql databases, however pdo works on 12 different database systems. Both are object oriented, but mysqli also offers a procedural option. And both support prepared statements to avoid sql injections. However i personally prefer pdo.
20th May 2017, 8:19 PM
David Padilla
David Padilla - avatar
+ 3
Mysql is still useful, but I've heard and read articles saying PDO is faster and safer. even thinking of starting writing game all over again using php 7 and PDO. Was using before php 5.2+ & mysql.
17th May 2017, 4:50 AM
VendeTTa
VendeTTa - avatar
+ 3
both mysqli and pdo...but, mysqli's syntax is easier!
17th May 2017, 2:48 PM
Philip Njuru
Philip Njuru - avatar
+ 2
PDO is a good method or a ORM like Doctrine
16th May 2017, 12:30 PM
⏩▶Clau◀âȘ
⏩▶Clau◀âȘ - avatar
+ 2
mysql is deprecated now use mysqli or pdo (preferred).
19th May 2017, 4:50 PM
Munish
Munish - avatar
+ 1
up
16th May 2017, 9:21 PM
Anass Kamal
Anass Kamal - avatar
+ 1
PDO is considered the latest and the greatest. If you want to use MySQL, be my guest but PDO is better.
19th May 2017, 2:06 PM
Bob
Bob - avatar
0
as far as I think.. MySQL is still a good choice
16th May 2017, 2:32 PM
Alister Animesh Baroi
Alister Animesh Baroi - avatar
0
both MySQLi and pdo but pdo can connect 12 languages at a time.
18th May 2017, 11:08 AM
Mayank Rai
Mayank Rai - avatar
0
10 language connect QCP driver with draw ling segment error mine... but nice performance..
18th May 2017, 2:11 PM
jatin(jerry)
jatin(jerry) - avatar
0
my sql
20th May 2017, 11:48 AM
Junaid Alam
Junaid Alam - avatar
21st May 2017, 4:51 PM
Pawan gond
Pawan gond - avatar