Jump to content

Recommended Posts

I am trying to make a e-mail script that will e-mail a someone ever minuet using there e-mail they input.

 

Well I get this error on the insert.php (add's the e-mail to the database)

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /mounted-storage/home48c/sub007/sc33591-LWQU/uploads/vote/insert.php on line 13

 

line 13 is blank. ??

 

Here is the whole script

 

<?php 
include ("config.php");

// connect to the mysql server

$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());

// select the database

mysql_select_db($database)
or die ("Could not select database because ".mysql_error());

// insert the data

// always set a form condiction.....

if(isset($_POST['submit'])){

//<<<<dont post within database statements......

$email=$_POST["email"]; 

$insert = mysql_query("insert into $table values ('$email')");
or die("Could not insert data because ".mysql_error());

// print a success message
echo "E-Mail Added To Database, starting to e-mail.";
echo "<meta http-equiv=Refresh content=2; URL=mailing.php>";

}
?>

 

-Thanks Guys

 

Link to comment
https://forums.phpfreaks.com/topic/74831-solved-please-help-me-php-and-mysql/
Share on other sites

<?php
$insert = mysql_query("insert into $table values ('$email')");   // <-- remove the ;
or die("Could not insert data because ".mysql_error());

 

The only parse error I can see is the ";" at the end of the line indicated above.

 

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.