I have data in mysql table something like this (I'm working on kruti dav 010 font)
id name description
1 'abc '"dbs
2 a'bc <'dns
3 /bc sb 'dcv
4 x"ydbv er?$#nv
5 y>/'b 'Dfr>?
6 p;q'd 'df@'d
Now i want to perform some operations like
INSERT INTO table_name (name,description ) VALUES ('x"ydv',''"dbs')
When i run this query values inside of single quotes there is an error because of '"dbs
INSERT INTO table_name (name,description ) VALUES ("x"ydv","'"dbs")
Similarly when i put values inside of double quotes there is an error because of x"ydv and '"dbs Now when i want to perform some operation like
<?php
$string='dbx;'pq';
echo $string;
?>
There is an error because of single quote inside of string I know solution of this problem using \ i can escape single quote inside of string.
Last problem
<?php
$array=Array ( [0] => dchj/kke [1] => jktukanxkao [2] => dksfj;k [3] => ukjk;.kiqj [4] => t'kiqj [5] => jk;x<+ [6] => "dksjck );
print_r($array);
$fields="'".implode("','", $array)."'";
echo $fields;
$this->db->select('id')->from('village')->where_in("name", $fields);
$query = $this->db->get();
echo $this->db->last_query();
?>
Output
Array (
[0] => dchj/kke
[1] => jktukanxkao
[2] => dksfj;k
[3] => ukjk;.kiqj
[4] => t'kiqj
[5] => jk;x<+
[6] => "dksjck )
'dchj/kke','jktukanxkao','dksfj;k','ukjk;.kiqj','t'kiqj','jk;x<+','"dksjck'
SELECT `id` FROM (`village`) WHERE `name` IN('\'dchj/kke\',\'jktukanxkao\',\'dksfj;k\',\'ukjk;.kiqj\',\'t\'kiqj\',\'jk;x<+\',\'"dksjck\'')
New when i run this query in mysql
MySQL returned an empty result set (i.e. zero rows). (Query took 0.0025 sec)
i have records in database for given array, but mysql returns zero rows