我知道,很简单,但正出现错误。
<?php
session_start();
$dbhost = "###"; // this will ususally be localhost , but can sometimes differ
$dbname = "###"; // the name of the database that you are going to use for this project
$dbuser = "###"; // the username that you created, or were given, to access your database
$dbpass = "###"; // the password that you created, or were given, to access your database
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
mysql_select_db("###", $con);
$safe_email = mysql_real_escape_string($_POST[ email ]);
$sql="INSERT INTO register (email) VALUES ( {$safe_email} )";
if (!mysql_query($sql,$con))
{
die( Error: . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>