Jump to content

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());

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.