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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jerck at rocware dot com
New email:
PHP Version: OS:

 

 [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: Sun May 05 03:01:29 2024 UTC