I am unable to execut long script the pdo throws an exception:
SQLSTATE[HY000]: General error
If I submit script which does not contain variables it runs w/o problem. The same script runs on phpmyadmin interface.
Here is my code snippet:
try {
$dsn = "mysql:host=" . DB_SERVER . ";dbname=" . DB_DEFAULT;
$db = new PDO($dsn, DB_USER, DB_PASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$q = $db->query($query);
if (!$q) {
echo $db->errorInfo();
} else {
$rows = $q->fetchAll(PDO::FETCH_ASSOC);
}
} catch (PDOException $e) {
var_dump($e);
}
Here is some test which does not execute by PDO:
SET @ra_LMC:=80.9;
SELECT @ra_LMC;
How I should execut with pdo the multi line scripts?
Thanks
Arman.