phpmysqlcodeignitermysql-real-escape-string

Codeigniter Deprecated: mysql_real_escape_string():


Got below error while using codigniter 3.0

FYI using PHP Version 5.5.12,Apache Version Apache/2.4.9 (Win64) PHP/5.5.12

A PHP Error was encountered

Severity: 8192

Message: mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

Filename: models/common_model.php

Line Number: 21

Backtrace:

File: C:\wamp\www\Codeigniter\application\models\common_model.php Line: 21 Function: mysql_real_escape_string


Solution

  • You should use PDO in codeigniter to solve all problem related to mysql and mysqli..

    see how to use PDO in CI if you are using CI 3 then http://www.codeigniter.com/user_guide/database/configuration.html

    and if you are using CI 2.x How to use pdo in codeigniter?