Jump to content

[SOLVED] T_CONSTANT_ENCAPSED_STRING?????


frijole

Recommended Posts

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/thinksna/public_html/email.php on line 29

 

<?php
/*Program:  email.php
*Desc:     PHP program that sends an email address to the DB for a mailing list.          
*/

if(ini_get("magic_quotes_gpc") == "1")
{
   $_POST['email'] = stripslashes($_POST['email']);
}

$host="localhost";
$user="removed";
$password="removed";

if(!empty($_POST['form']))
{
  mysql_connect($host,$user,$password);
  mysql_select_db(thinksna_email);
  $result = mysql_query($_POST['email']);

  if($result == false)
  {
     echo "<h4>Error: ".mysql_error($cxn)."</h4>";
  }
  else
  {
     $email = $_POST['email'];

mysql_query("INSERT INTO email (email, email_id, dateTime) VALUES ('$email', "" , NOW())") or die(mysql_error());

echo "'$email' was added to the list";

  }
  
?>

 

 

Link to comment
Share on other sites

You can't have unescaped double quotes inside a double quoted delimited string.

 

Change

<?php
mysql_query("INSERT INTO email (email, email_id, dateTime) VALUES ('$email', "" , NOW())") or die(mysql_error());
?>

to

<?php
mysql_query("INSERT INTO email (email, email_id, dateTime) VALUES ('$email', '', NOW())") or die(mysql_error());
?>

 

Ken

Link to comment
Share on other sites

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.