Reply to Re: [PHP] mysql improved extensions affected_rows

Your name:

Reply:


Posted by Tom on 01/14/05 12:04

Richard Lynch wrote:

>Tom wrote:
>
>
>>I've just started playing with the php5 improved mysqli extensions.
>>
>>I have the following code:-
>>
>><?php
>>$mysqlim = new mysqli("localhost", "myUser", "myPassword","myDB");
>>
>>$updateQuery = "UPDATE client SET status = 'INACTIVE' WHERE clientName =
>>'Tom'";
>>
>>if ($mysqli->query($updateQuery))
>>{
>> $updateCount = $mysqli->affected_rows;
>> echo "<br>updateCount = $updateCount";
>>}
>>else
>>{
>> excpetionHandler("updateFailed: ".$updateQuery);
>>}
>>?>
>>
>>
>>This returns "updateCount = 1"
>>However, when I check the underlying table, there are actually 4 rows
>>updated (and yes, before anyone asks, I have repeated this several
>>times, correctly resetting the data before each run)
>>
>>Is this a known bug, or am I doing something stupid?
>>(php 5.0.2, apache 2.0.49)
>>
>>
>
>How many rows actually had 'Tom' for their clientName?...
>
>I mean, is the '1' wrong because it should be 4, or is it changing records
>it shouldn't?
>
>
>
It correctly updates 4 rows, but returns 1 as the count.

I think that this may actually be a mysql issue - I've put the same
php/apache configs onto another similar box, the only difference being
that the second box is mysql 5.0.1, whereas the problem is reported
against 5.0.0 (both alpha's!). The correct value is returned from the
second box.

Thanks

Tom

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация