what is the best way to connect my database to my new website using php and mysql ?

Hi , i'm a computer science  student and i'm working on  a web development project (buiding a website for my higher shcool) . For the moment i had compeleted the front end of the site and i'm dealing with the back end side these days  using mysql and php . my problem is choosing the best way to connect my database to my website , is it mysqli or PDO ?
Nadir BELHADJfull stack web developerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
Terminology, you are connecting web site/PHP to the database.

Mysqli in PHP.

Have you already designed the database structure?

The database is the foundation. PHP is the structure.

The means by which the view the client sees is presented/updated depends on what it is you devide for the UI

A general question such as yours is difficult to answer.
It might be a combination of the two.
1
Nadir BELHADJfull stack web developerAuthor Commented:
so , you mean that the answer of my question depends on the type of the project ( the site ) ?
0
arnoldCommented:
each item has its benefits and drawbacks.
You have to based on your database structure, and business logic/proces who dictate the types of queries you need to extract the data.
Then the means by which you present the data I.e. Using Ajax, json, etc to dynamically update a subset of the display or entire page update when user either requests or the refresh frequency if set to auto refresh....
1
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

Ray PaseurCommented:
Here is an article that shows many of the basics of PHP and MySQLi and PDO working together.  It is written in parallel construction so you can see the similarities and differences in the extensions.  It was originally written because so many obsolete code samples litter the internet and they're full of references to the antiquated MySQL extension, which has been removed from PHP.  Have a look and see if it helps you consolidate your thinking about which way to go.
https://www.experts-exchange.com/articles/11177/PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html

In semi-related news, there are a lot of good examples on the internet, too.  Many of them are identified in this article.
https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html
1
Peos JohnPHPCommented:
Hi,

While both Mysqli and PDO are both provide faster connections to mysql database.  To know which one you should use, I would suggest to browser through the basic difference between them.


Mysqli- means MySQL Improved:
  1. Mysqli is a improved version of mysql functions
  2. It supports Mysql database only
  3. Mysqli supports Procedural and OOPs

PDO - PHP Data Object:
  1. PDO_MYSQL is the driver that helps in connecting php application  to Mysql
  2. http://php.net/manual/en/ref.pdo-mysql.php
  3. http://php.net/manual/en/ref.pdo-mysql.php
  4. PDO supports 12 different drivers(So this helps when there is a need to switch between the databases )
  5. PDO only OOP

Below are couple of links which discuss about the difference between them

https://code.tutsplus.com/tutorials/pdo-vs-mysqli-which-should-you-use--net-24059

http://www.tricksofit.com/2013/11/difference-between-pdo-and-mysqli#.WM1uuBKGOEI
1
Marco GasiFreelancerCommented:
Just a thought. If you are already familiar with mysql, mysqli will be easier to use, otherwise I would suggest to learn to use PDO and always use prepared statements.
Prepared statement is the only proper way to run a query
(https://phpdelusions.net/pdo)
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.