Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Tutorial Series: Using PHP's MySQLi API

DZone 's Guide to

Tutorial Series: Using PHP's MySQLi API

· Web Dev Zone ·
Free Resource

MySQL and PHP work wonders together, but sometimes getting them to talk can be a little less than obvious.

The official documentation of MySQLi, the improved MySQL API for PHP 5.0 and MySQL 4.1, can be a little terse. (Sometimes user comments are needed to complete the information.) But PHP draws people for its community too -- not just because the language is accessible and fast.

Lots of tutorials for MySQLi exist (here's a good one), but this new series from Ulf Wendel looks like one of the most efficient.

So far Ulf has posted three quick tutorials, in rapid succession (starting November 3rd).

  • The first, on stored procedures, just gives examples of IN, INOUT, and OUT parameters.
  • The second, on prepared statements, is a little more dense, but necessarily so: prepared statements are more efficient in the right circumstances (when executing one many times), and less efficient in others (when executing only once): in many cases, a multi-INSERT will be cheaper to run. To help you decide whether to use prepared statements, Ulf provides a thorough tabular breakdown of the exact differences between prepared and non-prepared statements in MySQLi.
  • Finally, the third post, on multiple statements in one statement string, explains how to reduce cliend-server roundtrips -- a technique that can pose some security problems, if handled incorrectly, but Ulf warns you about that.

More posts will be forthcoming -- soon, if Ulf's past performance indicates anything about future results. Stay tuned if you like what you've seen so far.

 

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}