Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating mysql database from php form help

Status
Not open for further replies.

rjseals

Technical User
Nov 25, 2002
63
US
When I use the form below to try and update my mysql database it goes to the confirmation page just fine with no apparent errors but no data gets put into the database.

Any suggestions or help would be greatly appreciated.


<html>
<body>
<?php


$db = mysql_connect(&quot;localhost&quot;, &quot;root&quot;, &quot;my_password&quot;);

mysql_select_db(&quot;mydb&quot;,$db);

$sql = &quot;INSERT INTO employees (First_Name, Last_Name, How_Many, Children) VALUES
('$First_Name','$Last_Name','$How_many','$Children')&quot;;

?>



<form method=&quot;post&quot; action=&quot;done.php&quot;>

First name:<input type=&quot;Text&quot; name=&quot;First_Name&quot;><br>

Last name:<input type=&quot;Text&quot; name=&quot;Last_Name&quot;><br>

How Many:<input type=&quot;Text&quot; name=&quot;How_Many&quot;><br>

Children:<input type=&quot;Text&quot; name=&quot;Children&quot;><br>

<input type=&quot;Submit&quot; name=&quot;submit&quot; value=&quot;Enter information&quot;>

</form>
</body>
</html>
 
Hi,

You forgot to execute the insert statement. Add the following line just before the '?>'

mysql_query($sql);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top