Note that there are some explanatory texts on larger screens.

plurals
  1. POmysqli data INSERT not working but no errors
    text
    copied!<p>mysqli data INSERT not working but there are no errors i just started with mysqli and i dont really know everything good i also saw the other questions about it but none of the solutions works for me </p> <p>this is the form: </p> <pre><code>&lt;head&gt; &lt;title&gt;NEW&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table border="1"&gt; &lt;tr&gt; &lt;td align="center"&gt;NEW&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;table&gt; &lt;form method="post" action="add.php"&gt; &lt;tr&gt; &lt;td&gt;name&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="name" size="20"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;type&lt;/td&gt; &lt;td&gt;&lt;select name="ptype"&gt; &lt;option value="a1"&gt;a1&lt;/option&gt; &lt;option value="a2"&gt;a2&lt;/option&gt; &lt;option value="a3"&gt;a3&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td align="right"&gt;&lt;input type="submit" name="submit" value="GO"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>this is the add.php file:</p> <pre><code>&lt;?php require("dbconnect.php"); if (isset($_POST['submit'])) { $db-&gt;query("SET NAMES 'utf8'"); $stmt = $db-&gt;prepare("INSERT INTO `business` (`ptype`, `name`) VALUES (?, ?)"); $stmt-&gt;bind_param('ss', $ptype, $name); $name = $_POST["name"]; $ptype = $_POST["ptype"]; printf("%d Row inserted.\n", $stmt-&gt;affected_rows); /* close statement and connection */ $stmt-&gt;close(); /* close connection */ } $db-&gt;close(); ?&gt; </code></pre> <p>and it says that 0 row inserted</p> <ul> <li>the dbconnect.php file contains the connection to mysqli</li> </ul>
 

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