Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot INSERT data into mysql using php
    primarykey
    data
    text
    <p>I have been trying for two days now to figure this one out. I copied verbatim from a tutorial and I still cant insert data into a table. here is my code with form</p> <pre><code>&lt;font face="Verdana" size="2"&gt; &lt;form method="post" action="Manage_cust.php" &gt; Customer Name &lt;font face="Verdana"&gt; &lt;input type="text" name="Company" size="50"&gt;&lt;/font&gt; &lt;br&gt; Customer Type &lt;font face="Verdana"&gt; &lt;select name="custType" size="1"&gt; &lt;option&gt;Non-Contract&lt;/option&gt; &lt;option&gt;Contract&lt;/option&gt; &lt;/select&gt;&lt;/font&gt; &lt;br&gt; Contract Hours &lt;font face="Verdana"&gt; &lt;input type="text" name="contractHours" value="0"&gt;&lt;/font&gt; &lt;br&gt; &lt;font face="Verdana"&gt; &lt;input type="submit" name="dothis" value="Add Customer"&gt;&lt;/font&gt; &lt;/form&gt; &lt;/font&gt; &lt;font face="Verdana" size="2"&gt; &lt;?php if (isset($_POST['dothis'])) { $con = mysql_connect ("localhost","root","password"); if (!$con){ die ("Cannot Connect: " . mysql_error()); } mysql_select_db("averyit_net",$con); $sql = "INSERT INTO cust_profile (Customer_Name, Customer_Type, Contract_Hours) VALUES ('$_POST[Company]','$_POST[custType]','$_POST[contractHours]')"; mysql_query($sql, $con); print_r($sql); mysql_close($con); } ?&gt; </code></pre> <p>This is my PHPmyadmin server info:</p> <p>Server: 127.0.0.1 via TCP/IP Software: MySQL Software version: 5.5.27 - MySQL Community Server (GPL) Protocol version: 10 User: root@localhost Server charset: UTF-8 Unicode (utf8)</p> <p>PLEASE tell me why this wont work. when I run the site it puts the info in and it disappears when I push the submit button, but it does not go into the table. There are no error messages that show up. HELP</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.
 

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