如果这是我的代码:
$mysqli = new mysqli("localhost", "user", "password", "mydb");
$city = "Some";
$q = "SELECT District FROM City WHERE (Name=? OR ? IS NULL)";
if ($stmt = $mysqli->prepare($q)) {
// How to Bind $city here?
}
我怎样才能绑定$city
到两个?
s?
或者有没有更好的方法来做到这一点?