求助php大神,php mysql的mysql_real_escape_string() 问题
大神门,我在自己的机子使用mysql_real_escape_string()这个函数没问题,可在别的机子就显示了(!)Warning:mysql_real_escape...
大神门,我在自己的机子使用mysql_real_escape_string() 这个函数没问题,可在别的机子就显示了
( ! ) Warning: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: Access denied for user ''@'localhost' (using password: NO) in C:\wamp\www\exam\work.php on line 116,,,,
我写的语句是
$sql=sprintf("insert into {$tableName}(试题编号,题型,题目,选项,答案) values('%s','%s','%s','%s','%s')",
mysql_real_escape_string($val1),
mysql_real_escape_string($val2),
mysql_real_escape_string($val3),
mysql_real_escape_string($val4),
mysql_real_escape_string($val5)
);
我的连接是$mysqli=new mysqli("localhost","root","123456","myexam"); 数据库的连接时正确的,因为可以创建正确的表,万分感谢!!!!! 展开
( ! ) Warning: mysql_real_escape_string() [<a href='function.mysql-real-escape-string'>function.mysql-real-escape-string</a>]: Access denied for user ''@'localhost' (using password: NO) in C:\wamp\www\exam\work.php on line 116,,,,
我写的语句是
$sql=sprintf("insert into {$tableName}(试题编号,题型,题目,选项,答案) values('%s','%s','%s','%s','%s')",
mysql_real_escape_string($val1),
mysql_real_escape_string($val2),
mysql_real_escape_string($val3),
mysql_real_escape_string($val4),
mysql_real_escape_string($val5)
);
我的连接是$mysqli=new mysqli("localhost","root","123456","myexam"); 数据库的连接时正确的,因为可以创建正确的表,万分感谢!!!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询