Sembra che PDO::MYSQL_ATTR_FOUND_ROWS non funzioni sulla piattaforma Altervista PHP/MySQL. Il programma seguente dovrebbe emettere '1', ma restituisce '0'.
Codice PHP:
<?php
error_reporting(-1);
ini_set('display_errors', '1');
$db_database = "your_database";
$db_host = 'localhost';
$db_login = "your_login";
$db_password = "your_password";
$dsn = "mysql:dbname=$db_database;host=$db_host";
$table = "altervista_found_rows_test";
$options = [PDO::MYSQL_ATTR_FOUND_ROWS => true];
$dbh = new PDO($dsn, $db_login, $db_password, $options);
$sql = "CREATE TABLE IF NOT EXISTS $table (id varchar(10), data int, PRIMARY KEY(id))";
$stmt = $dbh->prepare($sql);
$stmt->execute();
$sql = "INSERT IGNORE INTO $table (id, data) VALUES ('abcd', 1)";
$stmt = $dbh->prepare($sql);
$stmt->execute();
$sql = "UPDATE $table SET data=1 WHERE id='abcd'";
$stmt = $dbh->prepare($sql);
$stmt->execute();
echo $stmt->rowCount();