php - mysql_real_escape 字符串错误

标签 php mysql codeigniter mysql-real-escape-string

我正在尝试设置我最近在服务器上完成的 codeigniter 网络应用程序。我在自己的电脑上本地写的。但是,当我尝试登录时,出现了这两个错误。

A PHP Error was encountered

Severity: Warning

Message: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO)

Filename: mysql/mysql_driver.php

Line Number: 319



A PHP Error was encountered

Severity: Warning

Message: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established

Filename: mysql/mysql_driver.php

Line Number: 319

有人知道问题出在哪里吗?

最佳答案

首先确保你连接到你的数据库

您可以修改application/config/database.php中的设置

你应该使用 codeigniter

$this->db->escape() 

可在此处找到详细信息和示例 http://ellislab.com/codeigniter/user-guide/database/queries.html

关于php - mysql_real_escape 字符串错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13602286/

相关文章:

mysql生日提醒,闰年

mysql - MySQL 中使用 NOT EXIST 的查询未返回预期结果

php - 如何在开发人员之间使用具有不同数据库配置的 Git?

php - 如何将.txt文件导入不同表的mysql数据库

php - 将字段名称税收更改为增值税

php - codeigniter 中的 mysql_fetch_row

php - 是否可以将 cpanel 帐户位置/路径更改为不同的目录?

PHP 7 C++ 扩展。指定的模块无法找到

php - 在 Laravel 中获取站点名称和协议(protocol)

php - 在 CodeIgniter 中发送数据和重定向