This is my first script, so I am sorry it is so newbie-ish.
I think I have the correct script to open the connection, open the database
and the table. However, I cannot get the "insert into" to work. I have read
several online sources and books, all of which are slightly different. It is
not a parse error. Can you help?
Thanks
SJS
Script as follows:
<html>
<head><title>Adding Your Record to the Database</title></head>
<body>
<center>
<?php
if((!$lastName) || (!firstName) ||(!emailAddress))
{
echo "You have not entered all required informaton.<br> Please try again";
exit;
}
$lastName=addslashes($lastName);
$firstName=addslashes($firstName);
$email_address=addslashes($email_address);
@ $db=mysql_pconnect("", "","");
if (!$db)
{
echo "Couldn't connect to the database.<br>If problem persists, please
contact webmaster";
exit;
}
$db= mysql_select_db("emailDB");
if (!$db)
{
echo "Sorry. Could not retrieve correct database.<br> If problem persists,
please contact webmaster";
}
$sql = "INSERT INTO email_addresses VALUES ('$lastName', '$firstName',
'$email_address')";
$result = mysql_query($sql);
if (!$result)
{
echo "<p>Sorry.<br>Your address was not successfully added.<br>If problem
persists, please contact webmaster.";
}
else
{
echo "<p>DONE DEAL!";
}
?>
</body>
</html>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php