小编use*_*684的帖子

mySQL bind_param与IN(?)

使用bind_param我的所有查询,我现在想要使用IN(?)列表中元素数量可以变化的位置.

我在这里使用基本SQLOUT功能做了$sql_db->prepare,->bind_param,->execute(),->store_result(),->bind_result

// the code below does not work as the query only matches on element 'a':
$locations = ('a','b','c','d','e');

SQLout ("SELECT Name FROM Users WHERE Locations IN (?)",
    array('s', $locations), array(&$usrName));


// the code below does work as a brute-force method,
// but is not a viable solution as I can't anticipate the number of elements in $locations going forward:

SQLout ("SELECT Name FROM Users WHERE …
Run Code Online (Sandbox Code Playgroud)

php mysqli

5
推荐指数
1
解决办法
4601
查看次数

标签 统计

mysqli ×1

php ×1