因此,我设置了查询以在表中搜索以特定字母开头的用户名。
我的查询是这个
if(isset($_POST['search']) || (isset($_GET['search']))){
if($_GET['search'] && !$_POST['search']){
if($_GET['search'] == "!"){
$search = //What here for number and symbol check;
}
else
{
$search = $_GET['search'];
}
$search = $_GET['search'];
}
elseif($_POST['search'] && !$_GET['search'])
{
$search = $_POST['search'];
}
$stmt = $db->prepare("SELECT * FROM accounts WHERE username LIKE CONCAT(?, '%') OR id LIKE CONCAT('%', ?, '%') LIMIT $start, $limit");
它适用于所有字母 az,但我还需要检查那些出于某种原因决定以数字或符号开头的用户名(客户不希望我在注册时阻止特殊字符)所以我该怎么做检查这个?