Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP does not work INSERT INTO method
    text
    copied!<p>I am trying to insert into customer table in eshop_db When I run it, it does not have any error, but it did not store in mysql. What it is problem in my code? I don't understand really. Please give some answer. Thanks.</p> <p>--registerForm.php--</p> <pre><code>&lt;form action="register.php" method="post"&gt; &lt;p&gt;User ID: &lt;input type="text" name="userId" size="30"/&gt;*&lt;/p&gt; &lt;p&gt;Password: &lt;input type="password" name="password" size="30"/&gt;* &lt;/p&gt; &lt;p&gt;Retype Password: &lt;input type="password" name="repassword" size="30"/&gt;*&lt;/p&gt; &lt;p&gt;First Name: &lt;input type="text" name="firstName" size="30"/&gt;*&lt;/p&gt; &lt;p&gt;Last Name: &lt;input type="text" name="lastName" size="30"/&gt;*&lt;/p&gt; &lt;p&gt;Your Address (*):&lt;/p&gt; &lt;p&gt;&lt;textarea name="address" rows="5" cols="30"&gt;&lt;/textarea&gt;&lt;/p&gt; &lt;p&gt;Phone: &lt;input type="text" name="phone" size="20"/&gt;*&lt;/p&gt; &lt;p&gt;E-mail: &lt;input type="text" name="email" size="21"/&gt;*&lt;/p&gt; &lt;p&gt;&lt;input type="submit" value="Create Account"/&gt;&lt;/p&gt; &lt;/form&gt; </code></pre> <p>--register.php--</p> <pre><code>&lt;?php require "sql_connection.php"; if(isset($_POST['submit'])) { if($_POST["password"]==$_POST["repassword"]) { mysql_query("insert into customer (userId, password, firstName, lastName, address, phone, email) values ('$_POST[userId]','$_POST[password]','$_POST[firstName]','$_POST[lastName]','$_POST[addres]]','$_POST[phone]','$_POST[email]')") or die(mysql_error()); } } ?&gt; </code></pre> <p>--sql_connection.php--</p> <pre><code>&lt;?php $db_host = "localhost"; $db_username = "root"; $db_pass = "mypass"; $db_name = "eshop_db"; @mysql_connect("$db_host", "$db_username", "$db_pass", "$db_name") or die("connection is fail."); @mysql_select_db("$db_name") or die("database does not exsist."); echo "Successfully connected!!"; ?&gt; </code></pre>
 

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