Jump to content

INSERT INTO query problem, help please, site launch < 24hrs


mhgenterprises

Recommended Posts

Hello,

 

I can't see a problem in this script but I keep getting insert query failed errors.  Here it is, let me know if you see anything wrong, certain items are marked with ****** for security reasons:

 

<?php
############################
##   CONNECTION STRING    ##
############################

include '*****connection info******';

$dbconnection = mysql_connect($dbhost,$dbuser,$dbpassword);
$db = mysql_select_db($database,$dbconnection);

$email = $_POST['email'];

$email = substr($email, 0, 70);

if(ereg("^[-_.A-Za-z0-9]+@([-_A-Za-z0-9]+\.)+([-_A-Za-z0-9]+)$",$email))
{
$query = "INSERT INTO mailinglist (email) VALUES ('$email')";
mysql_query($query) or die('Error, insert query failed');
header("Location: http://www.nancygoldmanart.com/mailinglistsuccess.php");
return;
}
else
{
header("Location: http://www.nancygoldmanart.com/mailinglisterror.php");
}
?>

 

Go to http://www.nancygoldmanart.com and type in an e-mail address and hit submit in order to see the error.  Any help is greatly appreciated.  This site launches in about 24 hours!  Thanks!

Make the following code changes and post the results here:

 

     $query = "INSERT INTO mailinglist (email) VALUES ('$email')";
     mysql_query($query) or die('Error, insert query failed: '.$query.' error: '.mysql_error());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.