Warning: Undefined variable $kind in /home4/wgate/public_html/include/checkfunpdo.php on line 662

Warning: Undefined variable $vers in /home4/wgate/public_html/include/checkfunpdo.php on line 662

Warning: Undefined variable $kind in /home4/wgate/public_html/include/checkfunpdo.php on line 662

Warning: Undefined variable $vers in /home4/wgate/public_html/include/checkfunpdo.php on line 662
:::| 目前位置圖示目前位置:首頁圖示回首頁 | 主功能頁圖示相關問答
MYSQL查詢全型數字時和半型都能查到資料

[日期]:2026/09/09  [瀏覽人數]:20

當在輸入客戶編號要查詢該客戶編號時,
$sqls1 = "SELECT * FROM customer WHERE c_no=:cno";

輸入的編號如果輸入時數字用了全型,結果也能查出對應的半型數字的客戶資料…

若UTF8的編號使用有_ci的編碼,系統會有對應的索引能自動將轉全型轉成半型對應的數字。

那如果要讓全型和半型不同時可以加BINARY,就能將全型的數字和半型數字視為不同:

$sqls1 = "SELECT * FROM customer WHERE BINARY c_no=:cno";