Jump to content

[SOLVED] Please Help Me! PHP and MySQL


Lamez

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.

 

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.