Edit report at http://bugs.php.net/bug.php?id=51724&edit=1

 ID:               51724
 Updated by:       pierr...@php.net
 Reported by:      jerck at rocware dot com
 Summary:          int PDO::exec  (  string $statement  )
-Status:           Open
+Status:           Feedback
 Type:             Bug
 Package:          PDO related
 Operating System: Mac OS X 10.5.8
 PHP Version:      5.2SVN-2010-05-03 (SVN)

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2010-05-03 03:26:32] 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


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51724&edit=1

Reply via email to