error while using mysql_real_escape_string()

前端 未结 3 1910
花落未央
花落未央 2020-12-06 15:41

my code-

require \'database.php\';

$title = mysql_real_escape_string($_POST[\'title\']);  //line 48
$cat = $_POST[\'cat\'];
$txtart = mysql_real_escape_stri         


        
相关标签:
3条回答
  • 2020-12-06 16:13

    Please check your MySQL username and password and make sure you're entering them properly in mysql_connect. According to the error you didn't run mysql_connect with a password, which may be causing these problems.

    0 讨论(0)
  • 2020-12-06 16:14

    Check database.php connection strings, and the MySQL server is running as mysql_real_escape_string needs a valid open database connection to work.

    0 讨论(0)
  • 2020-12-06 16:21

    mysql_real_escape_string tries to connect to the local database, so it can fetch the settings it needs to escape the string correctly for that system.

    You can tell the function which connection to use by passing in a link identifier as a second argument:

    mysql_real_escape_string($string, $link)

    0 讨论(0)
提交回复
热议问题