Problem adding records

Problem adding records

am 02.02.2008 00:36:51 von DFS

Hi, I'm trying to use a PHP script to add a record. It's a very simple table
with three fields: Last Name, First Name and Email Address.

I ran this script and for some reason, the record doesn't get added, but all
the fields do come accross fine. That's why I have the thing at the end
where I displayed the fields. When I look at the table, the fields aren't
there. I don't get an error either.

The connect information has been changed for obvious security reasons. The
connect information does work fine with other programs, where it reads the
database. I think the problem likes in my SQL string.

The variable $result returns a blank.

Here is the code:


$phpform_lastname = $_POST['form_lastname'];
$phpform_firstname = $_POST['form_firstname'];
$phpform_email = $_POST['form_email'];

//Connect To Database
$hostname="hw329d32s7.securecomputer.com";
$username="joeuser";
$password="Deleb56";
$dbname="joeuser";
$usertable="addresses";

mysql_connect($hostname,$username, $password) OR DIE ("Unable to load the
Test Database! Please try again later.");
mysql_select_db($dbname);

//Make and execute SQL String

$query = "INSERT INTO `addresses` (`last_name`, `first_name`,
`emailaddress`) VALUES ($phpform_lastname, $phpform_firstname,
$phpform_email)";
$result = mysql_query($query);

?>







echo "The Result is: ".$result;

echo "
I just added the record with the following parameters.
";
echo "
";
echo "The Last name is: ".$phpform_lastname."
";
echo "The First name is: ".$phpform_firstname."
";
echo "The Email is: ".$phpform_email."
";

?>