CodeIgniter Forums
mysql_escape_string - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: mysql_escape_string (/showthread.php?tid=59907)

mysql_escape_string - El Forum - 12-08-2013

my colleague is making some tests with the new version of php(5.4.22) on our server and when i try to use my project in codeigniter i receve this message ..

A PHP Error was encountered

Severity: 8192

Message: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.

Filename: mysql/mysql_driver.php

Line Number: 319

what i can do?


mysql_escape_string - El Forum - 12-08-2013

I think the message is pretty self explanatory. Change mysql_escape_string to mysql_real_escape_string.

mysql_escape_string - El Forum - 12-09-2013

[quote author="xtremer360" date="1386532479"]I think the message is pretty self explanatory. Change mysql_escape_string to mysql_real_escape_string.[/quote]

really?n what way?
tell me please because i try and i have the same problem with mysql_real_escape_string

mysql_escape_string - El Forum - 12-09-2013

Switch driver to PDO

mysql_escape_string - El Forum - 12-09-2013

in what way?

mysql_escape_string - El Forum - 12-09-2013


What version of CodeIgniter your project is based on?

mysql_escape_string - El Forum - 12-09-2013


if you change version of PHP from 5.3 to 5.4 you must change the hostname


$db['default']['hostname'] = 'localhost';
$db['default']['hostname'] = '';

if you need to undestand better your problem use this code inside the page


echo '<pre>';
  echo '</pre>';

  echo 'Connecting to database: ' .$db['default']['database'];
    or die('Cannot connect to the database because: ' . mysql_error());
    mysql_select_db ($db['default']['database']);

    echo '<br />   Connected OK:'  ;
    die( 'file: ' .__FILE__ . ' Line: ' .__LINE__);