Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Out of all of the interactions performed on a database, the most often used command is a select statement. The select statement asks our database for data and retrieves those results. We’ll also look at how to handle errors with a query.
Example Code
try {
$db->query("SELECT title, category FROM Media");
} catch (Exception $e) {
echo "Bad query";
}
How to Ask Questions the Smart Way
Learning to query a database is an important part of programming, but learning to ask questions is even more important. Here is a great resource for leaning How to Ask Questions the Smart Way.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up