Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Failing but not reporting an error</h2> <p>Change <code>PDO</code>'s error reporting.</p> <pre><code>$MyConnection-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); </code></pre> <p>If there is an SQL error, PDO should report it now.</p> <h2>Select the Database</h2> <p>The only error I see in your query other than possible errors caused by variable interpolation is that the table name is not fully qualified. If you have not selected the DB already, it may need to be.</p> <pre><code>$MyConnection = new PDO("mysql:host=localhost;dbname=DBNAME"); // or in the query "INSERT INTO DBNAME.AMP_USERS ..." </code></pre> <p><em><strong>Note</em></strong> that you would not literally write <code>DBNAME</code> but rather what the actual name of your database is.</p> <h2>Use Prepared Statements</h2> <p>You should do this regardless to protect against injection, but based on the contents of the variables you are using, they may be causing problems as well.</p> <pre><code>$stmt = $MyConnection-&gt;prepare(" INSERT INTO AMP_USERS (Username, Password, Lastname, Email) VALUES (?,?,?,?) "); $stmt-&gt;execute(array($username, $password, $lastname, $email)); </code></pre> <p>Using named parameters like <code>$stmt-&gt;execute(array(":username" =&gt; $username))</code> or using <code>$stmt-&gt;bindParam(":username", $username)</code> (or <code>bindValue</code>) is also valid.</p> <hr> <p>If these explanations do not help you solve your problem you have omitted important data from your question.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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