萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mysql教程 >> mysql模糊查詢

mysql模糊查詢

mysql模糊查詢

雙引號中出現的變量將自動被解析。
$sql = "SELECT * FROM oneself WHERE name like '%{$colname_Recordset1}' LIMIT {$startRow_Recordset1}, {$maxRows_Recordset1}";
$Recordset1 = mysql_qu

雙引號中出現的變量將自動被解析。
$sql = "SELECT * FROM oneself WHERE name like '%{$colname_Recordset1}' LIMIT {$startRow_Recordset1}, {$maxRows_Recordset1}";
$Recordset1 = mysql_query($sql) or die(mysql_error());

{} 放在變量兩邊是直接指明這是個變量及該變量的名字,

查詢漢字,
select * from mytable where mysqlname like "%不%"

如果是大小字區分查詢英文字符,
select * from mytable where mysqlname like Binary("%A%")

如果上述條件均要
select * from mytable where mysqlname like "%不%" AND mysqlname like Binary("%A%")

 

select id,name from depart where name like %?%這只是對name進行了模糊查詢

我想在對id進行模糊查詢,應該怎麼樣做?
 
 

select id,name from depart where ID like '%123%'

copyright © 萬盛學電腦網 all rights reserved