php - PDO - rowCount() on update query -


so problem when reload page 2 times quickly, first time rowcount() returns 1 , second time returns me 0, , thats when interval every 100ms, example if change interval 1s rowcount() returns me everytime 1 no problems.

this code

$updated = $db->query('update urc set retime=? a=? , b=? , c=?',[time(),$a,$b,$c]); echo $updated->rowcount(); 

when select rows example everytime returns me 1, works without problem

$updated = $db->query('select 1 urc a=? , b=? , c=?',[$a,$b,$c]); echo $updated->rowcount(); 

variables a,b , c allways have same values.

and use class pdo

class pdosql{     private static          $username="root",         $password="",         $host="127.0.0.1",         $dbh;     public function connect($dbname){         return (self::$dbh = new pdo("mysql:dbname=".$dbname.";host=".self::$host, self::$username, self::$password,array(pdo::mysql_attr_init_command => "set names utf8")));     }     public function query($sql, $args){         $stmt = self::$dbh->prepare($sql);         $stmt->execute($args);         return $stmt;     } } 

so problem here update query or maybe database problem? i'm using innodb engine table.

i hope understand problem. sorry english.

thank you


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -