php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51724 int PDO::exec ( string $statement )
Submitted: 2010-05-03 03:26 UTC Modified: 2013-02-18 00:34 UTC
From: jerck at rocware dot com Assigned: pierrick (profile)
Status: No Feedback Package: PDO related
PHP Version: 5.2SVN-2010-05-03 (SVN) OS: Mac OS X 10.5.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
16 + 41 = ?
Subscribe to this entry?

 
 [2010-05-03 03:26 UTC] jerck at rocware dot com
Description:
------------
Explained succinctly in "test script" text area below...

<?php
// Back ticks do not adversely affect SQL. It runs without error.
$sql = "
  UPDATE `Business`
  SET `Business`.`Phone` = '1 (612) 986-6874'
  WHERE `Business`.`BusinessID` = 1
  LIMIT 1";

$count = DB::I()->exec($sql); // Singleton PDO DB handle

echo($count); // prints 0 of type integer

/**
 * $count should evaluate to the integer 1, not to 0.
 * Thoughts?
 **/
?>

Test script:
---------------
<?php
// Back ticks do not adversely affect SQL. It runs without error.
$sql = "
  UPDATE `Business`
  SET `Business`.`Phone` = '1 (612) 986-6874'
  WHERE `Business`.`BusinessID` = 1
  LIMIT 1";

$count = DB::I()->exec($sql); // Singleton PDO DB handle

echo($count); // prints 0 of type integer

/**
 * $count should evaluate to the integer 1, not to 0.
 * Thoughts?
 **/
?>

Expected result:
----------------
echo($count); // Should print the integer 1

Actual result:
--------------
echo($count); // Currently prints the integer 0 even though the database is successfully updating 1 record

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-03 15:26 UTC] pierrick@php.net
-Status: Open +Status: Feedback
 [2010-05-03 15:26 UTC] pierrick@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


It seems to work properly.

Could you try to execute the following statement before executing your script to 
make sure that the row you're trying to modify will really be affected by your 
query.

UPDATE `Business` SET `Business`.`Phone` = '' WHERE `Business`.`BusinessID` = 1
 [2010-05-03 15:27 UTC] pierrick@php.net
-Assigned To: +Assigned To: pierrick
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 14:01:35 2024 UTC