$pagename = 'index.html';
$dbh = connectDb();
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $dbh->query("select 'tcount' from accessNum where pagename = '$pagename'");
$record = $stmt->fetchAll();
if (sizeof($stmt) != 0) {
$counter = $record['tcount'];
$counter++;
$dbh->exec("update accessNum set tcount = '$counter' where pagename = '$pagename'");
}
mysql (table name is accessNum) is
pagename(varchar(255)) = index.html,
today(date) = 2015-08-31,
tcount(int(11)) = 1,
totalcount(int(11)) = 1,
the tcount keeps 1 every update. why it occurs?