Thank you, I took your advice but received this error "
Warning: mysql_connect() [
function.mysql-connect]: Access denied for
user 'unfthrea_surveyt'@'localhost' (using password: YES) in
/home/unfthrea/public_html/survey/insert.php on line
2
Could
not connect: Access denied for user 'unfthrea_surveyt'@'localhost' (using
password: YES)"
I chose a simple code to test things out.
<?php
$con = mysql_connect("localhost","unfthrea_surveyt","********");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$sql="INSERT INTO Persons (FirstName, LastName, Age)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?>
---------- Post added 04-13-2012 at 01:20 AM ---------- Previous post was 04-12-2012 at 11:31 PM ----------
I used a tutorial to make sure it wasn't anything I was doing.
http://www.freewebmasterhelp.com/tutorials/phpmysql
When I enter database, am I supposed to enter the name of the database AND the name of the table somehow?