我創建了一個將搜索範圍的值發送到數據庫的表單,但它似乎沒有工作。使用PHP PDO語句的SQL通配符charlist
查詢:
$alpha = $_POST['alpha'];
$sql = "SELECT * FROM tbl_members WHERE resultselect=? AND lname LIKE ?;";
$q = $conn->prepare($sql);
$q->execute(array($categoryid,"[".$alpha."]%"));
形式:
<form action="" method="post">
<button class="btn btn-link" value="abc" name="alpha">A-B-C</button>
<button class="btn btn-link" value="def" name="alpha">D-E-F</button>
</form>
演示(MySQL和SQL服務器,Oracle ......)? – peterm
我正在使用mysql –