Note that there are some explanatory texts on larger screens.

plurals
  1. POAction in a DATABASE with PHP
    primarykey
    data
    text
    <p>I have an error when i try to connect my database.</p> <pre><code>Error : SQLSTATE[HY093]: Invalid parameter number: parameter was not defined </code></pre> <p>I doubt it was the <code>ID</code> but with phpMyAdmin I put it AUTOINCREMENT ...</p> <p>Here's my code --></p> <p>From the DATABASE ON PHPMYADMIN</p> <pre><code>CREATE TABLE `Compte_Utilisateur`.`info_compte` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `username` VARCHAR( 15 ) NOT NULL , `suffixe` VARCHAR( 20 ) NOT NULL , `password` VARCHAR( 15 ) NOT NULL , `siteWeb` VARCHAR( 20 ) NOT NULL , `fonction` VARCHAR( 10 ) NOT NULL ) ENGINE = INNODB; </code></pre> <p>And from my file php --> I want to ADD a User to the DATABASE (But YOU ALL ALREADY KNOW :D)</p> <pre><code>&lt;?php $username = $_POST["username"]; $suffixe = $_POST["suffixe"]; $passwd = $_POST["password"]; $site = $_POST["site"]; $fonction = $_POST["fonction"]; try { $pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $bdd = new PDO('mysql:host=localhost;dbname=compte_utilisateur', 'root', '', $pdo_options); $req = $bdd-&gt;prepare('INSERT INTO info_compte(username, suffixe, password, siteWeb, fonction) VALUES(:username, :suffixe, :passwd, :site, :fonction)'); $req-&gt;execute(array( 'username' =&gt; $username, 'suffixe' =&gt; $suffixe, 'password' =&gt; $passwd, 'siteWeb' =&gt; $site, 'fonction' =&gt; $fonction, )); echo 'Compte ajouté avec succès'; } catch(Exception $e) { die('Erreur : ' . $e-&gt;getMessage()); } ?&gt; </code></pre> <p>Thanks to answer ! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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