1

As I am about to finish pset7 i was wondering if lets say I wanted to create a website from the scratch how would the website be connected to sql? I mean how will the website know how to look for a database and how to turn on that database?

1 Answer 1

0

There's more than one way to do it.

This w3schools article should help you to understand the pros and cons of using the PHP mysqli extension, or PHP Data Objects (PDO).

The CS50::query code written by David Malan provides a friendly front-end to PDO. You can look at the source code (inside the vendor directory) to see how that is implemented.

Keep in mind that there's also code in there related to JanRain's OpenID authentication library, which doesn't help you to connect to the database (it actually makes sure that you're signed in to Harvard or edX before you can use the library!)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .