Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML table inputting data to a mysql database
    primarykey
    data
    text
    <p>I am trying to get a form to input data into my "mysql database" however i am getting an error message and also it is inputting a blank data everytime the page loads.</p> <p>Here is my code:</p> <pre><code> &lt;form action="insert.php" method="post"&gt; Name: &lt;input type="text" name="name"&gt; &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; &lt;?php // This is the connection to my database $con = mysql_connect('127.0.0.1', 'shane', 'diamond89'); if (!$con){ die('Could not Connect: ' . mysql_error()); } // This creates my table layout echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;th&gt;ID&lt;/th&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Delete&lt;/th&gt; &lt;/tr&gt;"; // This selects which database i want to connect to $selected = mysql_select_db("shane",$con); if (!$con){ die("Could not select examples"); } // This inserts new information to the Database $query = "INSERT INTO test1 VALUES('id', '$name')"; $result = mysql_query($query); if ($result){ echo("Input data is Successful"); }else{ echo("Input data failed"); } // This chooses which results i want to select from $result = mysql_query("SELECT `id`, `name` FROM `test1` WHERE 1"); // This outputs the information into my table while ($row = mysql_fetch_array($result)) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['name'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . "[D]" . "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;"; // This closes my connection mysql_close($con); ?&gt; </code></pre> <p>Here is the error message:</p> <p>( ! ) SCREAM: Error suppression ignored for ( ! ) Notice: Undefined variable: name in C:\wamp\www\sql_table.php on line 36 Call Stack</p> <h1>Time Memory Function Location</h1> <p>1 0.0006 250360 {main}( ) ..\sql_table.php:0</p>
    singulars
    1. This table or related slice is empty.
    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