O'Reilly logo

Zend Framework 2 Cookbook by Josephus Callaars

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing simple queries

Querying the database is obviously something that we need to do once we are connected to the database. This recipe explains how this can be done, and the different methods available.

Getting ready

To make full of the following recipe, a Zend Framework 2 skeleton application should be used, with a MySQL server available to connect to. Don't forget that connecting to a MySQL server requires the mysql and mysqli extension enabled in PHP.

We have configured a database called book, with the table cards that has the columns id, color, type, and value. The SQL query to create the database and table are included in the code that comes with the book.

How to do it…

Queries come in all sort of forms, and in this recipe we will discuss ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required