Hello - beginner here...
I'm trying to insert records into a mysql db that are entered from an
html form. I'm not getting any errors, but the insert isn't working.
Am I missing something obvious? Thanks for any assistance...
Here is my code:
<?php
// Connect to MySQL
$cn = mysql_connect(" localhost", "root", "something" );
// Select the database
mysql_select_db ("employees_lgr ", $cn);
$first = $_REQUEST['first'];
$last = $_REQUEST['last'];
$address = $_REQUEST['address'];
$position = $_REQUEST['position'];
$strIns = "Insert into employees_lgr(f irst, last, address,
position ) values ";
$strIns .= "('$first','$la st','$address', '$position' )";
$result = mysql_query($st rIns, $cn);
if ($result)
print ("employee inserted into database \n");
?>
I'm trying to insert records into a mysql db that are entered from an
html form. I'm not getting any errors, but the insert isn't working.
Am I missing something obvious? Thanks for any assistance...
Here is my code:
<?php
// Connect to MySQL
$cn = mysql_connect(" localhost", "root", "something" );
// Select the database
mysql_select_db ("employees_lgr ", $cn);
$first = $_REQUEST['first'];
$last = $_REQUEST['last'];
$address = $_REQUEST['address'];
$position = $_REQUEST['position'];
$strIns = "Insert into employees_lgr(f irst, last, address,
position ) values ";
$strIns .= "('$first','$la st','$address', '$position' )";
$result = mysql_query($st rIns, $cn);
if ($result)
print ("employee inserted into database \n");
?>
Comment