mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Make use of the existing entity for this problem.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@187293 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
d92afa835a
commit
0c6bee02b0
1 changed files with 9 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
|
||||
<refentry id="function.PDO-exec">
|
||||
<refnamediv>
|
||||
|
@ -55,23 +55,19 @@
|
|||
<function>PDO::exec</function> returns <literal>0</literal>.
|
||||
</para>
|
||||
|
||||
<warning>
|
||||
<para>
|
||||
Do not rely on the return value as an indicator of success. The following
|
||||
example incorrectly relies on the return value of
|
||||
<function>PDO::exec</function>:
|
||||
<programlisting role="php">
|
||||
&return.falseproblem;
|
||||
<para>
|
||||
The following example incorrectly relies on the return value of
|
||||
<function>PDO::exec</function>, wherein a statement that affected 0 rows
|
||||
results in a call to <function>die</function>:
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$db->exec() or die($db->errorInfo());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
The previous example is incorrect because the SQL statement may
|
||||
legitimately return 0 affected rows, and <function>die</function> does
|
||||
not distinguish between <literal>0</literal> and &false;.
|
||||
</para>
|
||||
</warning>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
|
|
Loading…
Reference in a new issue