【发布时间】:2011-12-11 16:18:47
【问题描述】:
我想为使用json_encode 存储在数据库中的值 json 完成“HAVING”,这个值是波斯语单词但没有为它完成“HAVING”,如何解决?
row_s 为:
row_s id 1:["All5","\u0648\u06cc\u0632\u0627 8"]row_s id 2:["All5","\u0648\u06cc\u0632\u0627 7"]row_s id 3:["All5","\u0648\u06cc\u0632\u0627 6"]
这是我的php代码:(输出是:没有)
$val = 'ویزا 8';
$query = $this->db->query('SELECT * FROM table HAVING row_s LIKE "%' . $val . '%"');
if ($query->num_rows() > 0) {
foreach ($query->result() as $val) {
echo $val->name . '<br>';
}
} else {
echo 'There is not';
}
更新: 可以 where value “$val” 是数字或拉丁词,在数据库中具有值 json,但不能用于波斯词。
例如,下面的代码有输出,并且是 $query->num_rows()=3。
$val = 'All5';
$query = $this->db->query('SELECT * FROM table HAVING row_s LIKE "%' . $val . '%"');
if ($query->num_rows() > 0) {
foreach ($query->result() as $val) {
echo $val->name . '<br>';
}
} else {
echo 'There is not';
}
【问题讨论】:
-
亲爱的你的问题含糊不清。我们无法理解实际的问题是什么?请尝试更详细地阐述您的问题和问题
-
你的数据库代码页/排序规则是什么?
-
@user973254 - collation=>utf8_general_ci ,代码页??
-
show variables like '%char%; -
@user973254 - 我不明白你的目的!!!?
标签: php mysql json codeigniter