reference/mysqli/overview.xml
40667918dcff1d5c9f7ecdc88b5caca24ba0686c
...
...
@@ -23,11 +23,11 @@
23
23
</para>
24
24

25
25
<para>
26
-
APIs can be procedural or object-oriented. With a procedural API you
26
+
APIs can be procedural or object-oriented. With a procedural API, you
27
27
call functions to carry out tasks, with the object-oriented API you
28
28
instantiate classes and then call methods on the resulting objects.
29
-
Of the two the latter is usually the preferred interface, as it is
30
-
more modern and leads to better organized code.
29
+
Of the two, the latter is usually the preferred interface, as it is
30
+
more modern and leads to better-organized code.
31
31
</para>
32
32

33
33
<para>
...
...
@@ -51,7 +51,7 @@
51
51
<para>
52
52
If your PHP application needs to communicate with a database server
53
53
you will need to write PHP code to perform such activities as
54
-
connecting to the database server, querying the database and other
54
+
connecting to the database server, querying the database, and other
55
55
database-related functions. Software is required to provide the API
56
56
that your PHP application will use, and also handle the
57
57
communication between your application and the database server,
...
...
@@ -95,8 +95,8 @@
95
95
In the PHP documentation you will come across another term -
96
96
<emphasis>extension</emphasis>. The PHP code consists of a core,
97
97
with optional extensions to the core functionality. PHP's
98
-
MySQL-related extensions, such as the <literal>mysqli</literal>
99
-
extension, and the <literal>mysql</literal> extension, are
98
+
MySQL-related extensions, such as the mysqli
99
+
extension, and the PDO MySQL driver extension, are
100
100
implemented using the PHP extension framework.
101
101
</para>
102
102

...
...
@@ -125,7 +125,7 @@
125
125
</para>
126
126

127
127
<para>
128
-
There are three main API options when considering connecting to a
128
+
There are two main API options when considering connecting to a
129
129
MySQL database server:
130
130
</para>
131
131

...
...
@@ -133,12 +133,6 @@
133
133

134
134
<listitem>
135
135
<para>
136
-
PHP's MySQL Extension
137
-
</para>
138
-
</listitem>
139
-

140
-
<listitem>
141
-
<para>
142
136
PHP's mysqli Extension
143
137
</para>
144
138
</listitem>
...
...
@@ -158,37 +152,6 @@
158
152
</para>
159
153

160
154
<para>
161
-
<emphasis role="bold">What is PHP's MySQL Extension?</emphasis>
162
-
</para>
163
-

164
-
<para>
165
-
This is the original extension designed to allow you to develop PHP
166
-
applications that interact with a MySQL database. The
167
-
<literal>mysql</literal> extension provides a procedural interface
168
-
and is intended for use only with MySQL versions older than 4.1.3.
169
-
This extension can be used with versions of MySQL 4.1.3 or newer,
170
-
but not all of the latest MySQL server features will be available.
171
-
</para>
172
-

173
-
<note>
174
-
<para>
175
-
If you are using MySQL versions 4.1.3 or later it is
176
-
<emphasis>strongly</emphasis> recommended that you use the
177
-
<literal>mysqli</literal> extension instead.
178
-
</para>
179
-
</note>
180
-

181
-
<para>
182
-
The <literal>mysql</literal> extension source code is located in the
183
-
PHP extension directory <filename>ext/mysql</filename>.
184
-
</para>
185
-

186
-
<para>
187
-
For further information on the <literal>mysql</literal> extension,
188
-
see <xref linkend="book.mysql"/>.
189
-
</para>
190
-

191
-
<para>
192
155
<emphasis role="bold">What is PHP's mysqli Extension?</emphasis>
193
156
</para>
194
157

...
...
@@ -237,23 +200,9 @@
237
200
</para>
238
201
</listitem>
239
202

240
-
<listitem>
241
-
<para>
242
-
Embedded server support
243
-
</para>
244
-
</listitem>
245
-

246
203
</itemizedlist>
247
204
</para>
248
205

249
-
<note>
250
-
<para>
251
-
If you are using MySQL versions 4.1.3 or later it is
252
-
<emphasis>strongly</emphasis> recommended that you use this
253
-
extension.
254
-
</para>
255
-
</note>
256
-

257
206
<para>
258
207
As well as the object-oriented interface the extension also provides
259
208
a procedural interface.
...
...
@@ -313,7 +262,7 @@
313
262

314
263
<para>
315
264
The PDO MYSQL driver is not an API as such, at least from the PHP
316
-
programmer's perspective. In fact the PDO MYSQL driver sits in the
265
+
programmer's perspective. In fact, the PDO MYSQL driver sits in the
317
266
layer below PDO itself and provides MySQL-specific functionality.
318
267
The programmer still calls the PDO API, but PDO uses the PDO MYSQL
319
268
driver to carry out communication with the MySQL server.
...
...
@@ -342,8 +291,7 @@
342
291
</para>
343
292

344
293
<para>
345
-
In order to communicate with the MySQL database server the
346
-
<literal>mysql</literal> extension, <literal>mysqli</literal> and
294
+
In order to communicate with the MySQL database server, <literal>mysqli</literal> and
347
295
the PDO MYSQL driver each use a low-level library that implements
348
296
the required protocol. In the past, the only available library was
349
297
the MySQL Client Library, otherwise known as
...
...
@@ -354,14 +302,13 @@
354
302
However, the interface presented by <literal>libmysqlclient</literal> was
355
303
not optimized for communication with PHP applications, as
356
304
<literal>libmysqlclient</literal> was originally designed with C
357
-
applications in mind. For this reason the MySQL Native Driver,
305
+
applications in mind. For this reason, the MySQL Native Driver,
358
306
<literal>mysqlnd</literal>, was developed as an alternative to
359
307
<literal>libmysqlclient</literal> for PHP applications.
360
308
</para>
361
309

362
310
<para>
363
-
The <literal>mysql</literal> extension, the
364
-
<literal>mysqli</literal> extension and the PDO MySQL driver can
311
+
Both, the <literal>mysqli</literal> extension and the PDO MySQL driver can
365
312
each be individually configured to use either
366
313
<literal>libmysqlclient</literal> or <literal>mysqlnd</literal>. As
367
314
<literal>mysqlnd</literal> is designed specifically to be utilised
...
...
@@ -370,13 +317,6 @@
370
317
advantage of these improvements.
371
318
</para>
372
319

373
-
<note>
374
-
<para>
375
-
The MySQL Native Driver can only be used with MySQL server
376
-
versions 4.1.3 and later.
377
-
</para>
378
-
</note>
379
-

380
320
<para>
381
321
The MySQL Native Driver is implemented using the PHP extension
382
322
framework. The source code is located in
...
...
@@ -396,23 +336,21 @@
396
336
</para>
397
337

398
338
<para>
399
-
The following table compares the functionality of the three main
339
+
The following table compares the functionality of the main
400
340
methods of connecting to MySQL from PHP:
401
341
</para>
402
342

403
-
<table>
343
+
<table xml:id="mysqli.overview.option.comparison">
404
344
<title>Comparison of MySQL API options for PHP</title>
405
-
<tgroup cols="4">
406
-
<colspec colwidth="25*"/>
407
-
<colspec colwidth="25*"/>
408
-
<colspec colwidth="25*"/>
409
-
<colspec colwidth="25*"/>
345
+
<tgroup cols="3">
346
+
<colspec colwidth="34*"/>
347
+
<colspec colwidth="33*"/>
348
+
<colspec colwidth="33*"/>
410
349
<thead>
411
350
<row>
412
351
<entry></entry>
413
352
<entry>PHP's mysqli Extension</entry>
414
353
<entry>PDO (Using PDO MySQL Driver and MySQL Native Driver)</entry>
415
-
<entry>PHP's MySQL Extension</entry>
416
354
</row>
417
355
</thead>
418
356
<tbody>
...
...
@@ -420,61 +358,41 @@
420
358
<entry>PHP version introduced</entry>
421
359
<entry>5.0</entry>
422
360
<entry>5.0</entry>
423
-
<entry>Prior to 3.0</entry>
424
-
</row>
425
-
<row>
426
-
<entry>Included with PHP 5.x</entry>
427
-
<entry>yes</entry>
428
-
<entry>yes</entry>
429
-
<entry>Yes</entry>
430
361
</row>
431
362
<row>
432
363
<entry>MySQL development status</entry>
433
364
<entry>Active development</entry>
434
-
<entry>Active development as of PHP 5.3</entry>
435
-
<entry>Maintenance only</entry>
436
-
</row>
437
-
<row>
438
-
<entry>Recommended by MySQL for new projects</entry>
439
-
<entry>Yes - preferred option</entry>
440
-
<entry>Yes</entry>
441
-
<entry>No</entry>
365
+
<entry>Active development</entry>
442
366
</row>
443
367
<row>
444
368
<entry>API supports Charsets</entry>
445
369
<entry>Yes</entry>
446
370
<entry>Yes</entry>
447
-
<entry>No</entry>
448
371
</row>
449
372
<row>
450
373
<entry>API supports server-side Prepared Statements</entry>
451
374
<entry>Yes</entry>
452
375
<entry>Yes</entry>
453
-
<entry>No</entry>
454
376
</row>
455
377
<row>
456
378
<entry>API supports client-side Prepared Statements</entry>
457
379
<entry>No</entry>
458
380
<entry>Yes</entry>
459
-
<entry>No</entry>
460
381
</row>
461
382
<row>
462
383
<entry>API supports Stored Procedures</entry>
463
384
<entry>Yes</entry>
464
385
<entry>Yes</entry>
465
-
<entry>No</entry>
466
386
</row>
467
387
<row>
468
388
<entry>API supports Multiple Statements</entry>
469
389
<entry>Yes</entry>
470
390
<entry>Most</entry>
471
-
<entry>No</entry>
472
391
</row>
473
392
<row>
474
393
<entry>Supports all MySQL 4.1+ functionality</entry>
475
394
<entry>Yes</entry>
476
395
<entry>Most</entry>
477
-
<entry>No</entry>
478
396
</row>
479
397
</tbody>
480
398
</tgroup>
481
399