我越来越Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'username'@'localhost' (using password: NO)
这是我的代码..
<?php
include 'config.php';
$email = mysql_real_escape_string($_GET['email']);
$validation = filter_var($email, FILTER_VALIDATE_EMAIL);
if ( $validation ) {
// Make a MySQL Connection
mysql_connect($Host,$Username,$Password) or die(mysql_error());
mysql_select_db($Database) or die(mysql_error());
// Insert rows
mysql_query("INSERT INTO formusers
(formemail) VALUES('$email') ")
or die(mysql_error());
}
?>
如果我移动线路以建立数据库连接,它确实有效。使用前是否需要建立数据库连接,mysql_real_escape_string
还是我做错了?