我越來越Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'username'@'localhost' (using password: NO)
mysql_real_escape_string錯誤
這裏是我的代碼..
<?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
之前是否需要建立數據庫連接?或者我只是做錯了嗎?