我的数据库中有一列名为foodtype。表名是餐馆,列foodtype有逗号分隔的值(如印度语、中文)。
现在,当一个人选择中文时,我想要的mysql查询应该返回foodtype是中文的餐馆。
查询应如下所示:
SELECT * FROM restaurant WHERE cityname='Chicago' and foodtype
LIKE ('%Chinese%')
当一个人选择印度人时,我想要mysql查询应该返回餐厅,那里的食物类型是印度的。
查询应如下所示:
SELECT * FROM restaurant WHERE cityname='
如何添加span标记来包装另一个不在regex中的字符串?
// This is english & some <span>中文</span> character <span>字元</span>.
var str = 'This is english & some 中文 character 字元.'
var pattern = new RegExp(/[a-zA-Z0-9 _^!-~-]/);
console.log( pattern.test(str));
我有一些中文字符(例如中文(简体))存储在内容类型为utf8_bin的mysql数据库中。
我使用以下代码从数据库中提取数据:
if($stmt = $mysqli->prepare("SELECT c_color FROM colors")){
$stmt->execute();
$stmt->bind_result($ccolor);
$stmt->store_result();
if($stmt->fetch()){
//$ccolor is filled with question marks