Note that there are some explanatory texts on larger screens.

plurals
  1. POI can not insert into MariaDB table with my PHP script
    text
    copied!<p>I recently moved to MariaDB, because since MySQL 5.6 it has been failing a lot for me.</p> <p>MariaDB works flawlessly but, in a new project, I cannot insert data to the database with a PHP script. I can only insert manually. I have made no changes from scripts working with MySQL.</p> <p>The INSERT statement is:</p> <pre><code>INSERT INTO participantes (nome, curso, email, equipe) VALUES (:nome, :curso, :email, :equipe); </code></pre> <p>And the script which should be inserting is:</p> <pre><code>$stmt = $this-&gt;dbh-&gt;prepare($this-&gt;SQL_INSERT); $nome = $participante-&gt;nome(); $curso = $participante-&gt;curso(); $email = $participante-&gt;email(); $equipe = $participante-&gt;equipe(); $stmt-&gt;bindParam(':nome', $nome); $stmt-&gt;bindParam(':curso', $curso); $stmt-&gt;bindParam(':email', $email); $stmt-&gt;bindParam(':equipe', $equipe); $stmt-&gt;execute(); </code></pre> <p>The "participante" functions return data to be used, with no problems. Everything is inside a try/catch block, which reports no exceptions.</p> <p>My PDO class is as follows:</p> <pre><code>class Connection extends PDO { private $dsn = 'mysql:host=localhost;port=3307;dbname=dacu'; private $usr = 'dacu'; private $pwd = 'my password'; public $handle = null; function __construct() { try { if ($this-&gt;handle == null) { $dbh = new PDO($this-&gt;dsn, $this-&gt;usr, $this-&gt;pwd); $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this-&gt;handle = $dbh; return $this-&gt;handle; } } catch (PDOException $e) { throw new Exception('Não foi possível conectar-se ao banco de dados: ' . $e-&gt;getMessage()); } catch (Exception $e) { throw new Exception('Um erro não identificado ocorreu: ' . $e-&gt;getMessage()); } } } </code></pre> <p>And using controller->insert gives me:</p> <pre><code>Warning: PDO::prepare(): SQLSTATE[00000]: No error: PDO constructor was not called in C:\Webserver\Files\dacu\controller\EquipesController.php on line 25 </code></pre> <p>I can post code on pastebin if necessary, just ask.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload