Count =
2832
//Fetch the value of count, and then increment it
$username="aaa";
$password="bbb";
$database="ccc";
$count = 0;
try {
$dbh = new PDO('mysql:host=localhost;dbname='.$database, $username, $password);
foreach($dbh->query('SELECT count from t_count') as $row) {
$count = $row['count'];
print $count;
}
$sql = "update t_count set count=:count";
$q = $dbh->prepare($sql);
$q->execute(array(':count'=>$count+1));
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "
";
die();
}