MySQL remote connection fails with “unknown authentication method”

I am trying to remotely connect to MySQL server online from my local machine, but I am getting the following error: Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password] in C:\xampp\htdocs\ticket\terminal\sync.php SQLSTATE[HY000] [2054] The server requested authentication method umknown to the client My local MySQL server version is 5.5.27, libmysql – … Read more

How do I insert into SQLite with PDO extension?

I’m having a bit of trouble inserting into a sqlite3 database with pdo. You’ll have to excuse my ignorance with PDO, it seems so foreign coming from Python’s database interface. So here’s my problem. I have a simple insert: $dbh = new PDO(‘sqlite:vets.db’); $count = $dbh->exec(“INSERT INTO vets(name,email,clinic,streetname,citystatezip,link,phone,fax,animal,region,visible) VALUES ($name,$email,$clinic,$streetname,$citystatezip,$link,$phone,$fax,$animal,$region,$visible)”); $dbh = null; I simply … Read more

What PDO driver to use with mariadb?

After replacing mysql with mariadb, I encountered the following error: PHP Fatal error: Uncaught exception ‘PDOException’ with message ‘could not find driver’ in /var/www/inlcude/config.php:5\nStack trace:\n#0 /var/www/inlcude/config.php(5): PDO->__construct(‘mysql:dbname=my…’, ‘apache’, ‘ABCDE…’)\n#1 /var/www/html/index(21): require(‘/var/www/inlcude/con…’)\n#2 {main}\n thrown in /var/www/inlcude/config.php on line 5 I have read through the following two related questions, but can’t find the answer there: PDO and … Read more

Call to a member function fetch() on boolean [duplicate]

This question already has an answer here: My PDO Statement doesn’t work (1 answer) Closed 1 year ago. I receive this error: Fatal error: Call to a member function fetch() on boolean in C:\xampp\htdocs\repo\generator\model\database.php on line 34 When I run this code: class database { private $user = ‘root’; private $pass = ”; public $pdo; … Read more

Effect of LoaderOptimizationAttribute

I have written a small piece of code regarding the dynamic loading of assemblies and creating class instances from those assemblies, including an executable, a test lib to be dynamically loaded and a loader library to load dynamic assembly into a new Appdomain. Loader library is referenced by both executable and the dynamic library. //executable … Read more

Insert/update helper function using PDO

I have a very simple helper function to produce SET statement for traditional plain mysql driver usage: function dbSet($fields) { $set=”; foreach ($fields as $field) { if (isset($_POST[$field])) { $set.=”`$field`='”.mysql_real_escape_string($_POST[$field]).”‘, “; } } return substr($set, 0, -2); } used like this $id = intval($_POST[‘id’]); $fields = explode(” “,”name surname lastname address zip fax phone”); $_POST[‘date’] … Read more

How does PDO know last inserted id in MySQL?

EDIT: This question title originally was: How does Doctrine know last inserted id in MySQL? and was related to Doctrine ORM mapper. After some digging I found out that this question is not related to Doctrine but to PDO_MySQL, MySQL C API and finally – to MySQL client-server communication. I have decided to change the … Read more