为什么 new mysqli 会出错?
$db = new mysqli('localhost', 'root', '', 'tran');
$name = 'jack';
$sql_1 = sprintf('INSERT INTO `tb_user` (name)VALUES("%s")',mysql_real_escape_string($name));
$db->query($sql_1);
为什么会出现
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost'
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in
这两个句错误的,我知道如果连不上数据库mysql_real_escape_string是会报错的,但我明明连接上了,
如果换回mysql_connect() mysql_select_db mysql_query()这样的链接就没问题
还有就是我的字段 name 设置的是not null 为什么上面的sql语句执行了抛出 Warning 这样严重的错误还会保存一个空值的?not null 不是不能为空否则不能保存的吗?
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号