This question shows research effort; it is useful and clear
-6
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
如何在 foreach 函数中访问数组键,然后传递给 mysql 查询。以下代码返回空白页。当“key”为static id='2'时,没有问题。但我需要使用数组键,而不是静态值。
foreach ($base as $key => &$value) {
$value = db_query("SELECT * FROM {bo_subject} WHERE exam LIKE '%$key%'")->fetchAllKeyed() or exit(mysql_error());
}