我正在尝试运行一个PHP页,该页应在我的MSSQL表“用户”中插入用户名和密码。当我运行页面时,唯一出现的错误是:
Warning: mssql_query() [function.mssql-query]: message: 'md5' is not a recognized built-in function name. (severity 15) in D:\Hostins0\html\insertadminaccount.php on line 10 Warning: mssql_query() [function.mssql-query]: Query failed in D:\Hostinstml\insertadminaccount.php on line 10 'md5' is not a recognized built-in function name.
这是我完整的PHP页面代码:
<?php $conn=mssql_connect('sm','Gaer','Ra1!'); mssql_select_db('Gser',$conn); if(! $conn ) { die('Could not connect: ' . mssql_get_last_message()); } $sqla = "INSERT INTO users (username, password) VALUES ('rob_dewar01', " . md5 ('KingDozer') . ")"; mssql_query($sqla, $conn) or die(mssql_get_last_message()); if (!mssql_query) { // The query has failed, print a nice error message // using mssql_get_last_message() die('MSSQL error: ' . mssql_get_last_message()); } mssql_close($conn); ?>
感谢您的任何帮助。感谢所有帮助。
MSSQL没有直接md5函数。您需要像这样通过PHP使用它:
md5
$sqla = "INSERT INTO users (username, password) VALUES ('rob_dewar01', '" . md5('KingDozer') . "')";
而且,md5是不安全的。查看使用准备好的语句。