Lamez Posted October 26, 2007 Share Posted October 26, 2007 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 More sharing options...
darkfreaks Posted October 26, 2007 Share Posted October 26, 2007 <?php $insert = mysql_query('insert into '.$table.' values ('.$email.')'); or die("Could not insert data because ".mysql_error());?> or <?php insert = mysql_query("insert into $table values ($email)");?> Link to comment https://forums.phpfreaks.com/topic/74831-solved-please-help-me-php-and-mysql/#findComment-378388 Share on other sites More sharing options...
Barand Posted October 26, 2007 Share Posted October 26, 2007 <?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. Link to comment https://forums.phpfreaks.com/topic/74831-solved-please-help-me-php-and-mysql/#findComment-378463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.