Getting console error : mysql_real_escape_string() when used ignited datatable codeigniter -
this console error got mysql_real_escape_string(): mysql extension deprecated , removed in future: use mysqli or pdo instead. error got in datatable library file.anybody knows issue?
my controller
public function manageuser() { $tmpl = array ( 'table_open' => '<table id="big_table" border="1" cellpadding="2" cellspacing="1" class="mytable">' ); $this->table->set_template($tmpl); $this->table->set_heading('first name','last name','email'); $this->load->view('moderator/manageuser'); } public function datatable() { $this->datatables ->select("mro_id,mro_name,mctg_name,mctg_id") ->from('jil_mroproducts') ->join('jil_mrocategory', 'jil_mroproducts.mro_category=jil_mrocategory.mctg_id', 'inner') ->edit_column('mro_name', '<a href="user/edit/$1">$2</a>', 'mro_id, mro_name'); //->unset_column('mro_id'); echo $this->datatables->generate(); }
my view
<html> <head> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <title>subscriber management</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <link rel="stylesheet" href="<?php echo base_url();?>assets/css/datatable.css" type="text/css" media="screen"/> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen"/> <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/jquery.datatables.min.js"></script> </head> <body> <div class="wrapper"> <script type="text/javascript"> $(document).ready(function() { var otable = $('#big_table').datatable( { "bprocessing": true, "bserverside": true, "sajaxsource": '<?php echo base_url(); ?>moderator/user/datatable', "bjqueryui": true, "spaginationtype": "full_numbers", "idisplaystart ":20, "olanguage": { "sprocessing": "<img src='<?php echo base_url(); ?>assets/images/ajax-loader_dark.gif'>" }, "fninitcomplete": function() { //otable.fnadjustcolumnsizing(); }, 'fnserverdata': function(ssource, aodata, fncallback) { $.ajax ({ 'datatype': 'json', 'type' : 'post', 'url' : ssource, 'data' : aodata, 'success' : fncallback }); } } ); } ); </script> <h1>subscriber management</h1> <?php echo $this->table->generate(); ?> </div> </body> </html>
i used code datatable.
http://www.ahmed-samy.com/php-codeigniter-full-featrued-jquery-datatables-part-2/
the code uses mysql_real_escape_string() in library deprecated.
you have remove mysql_real_escape_string() code , use custom code.
otherwise must use mysqli driver codeigniter. can use mysqli_real_escape_string().
codeigniter switching driver mysql --> mysqli
update: added angel's solution below.
$ssearch =$this->ci->db->escape_like_str($this->ci->input->post('ssearch'));
Comments
Post a Comment