在 PHP/MySQL 查询中传递两个或更多 URL 参数
Pass two or more URL parameters in a PHP/MySQL query
这个有效:
searchR.php?status=pending
这有效:
searchR.php?status=rerun
但这不是(仅列出 "pending"):
searchR.php?status=pending&rerun
我的目标是构建一个查询,该查询将列出来自两个术语("pending" 和 "rerun")的记录
URL 应该是什么样的?
使用符号向 url 引入新的变量和参数。例子
searchR.php?status=$pending&rerun=$running
searchR.php?status=pending&rerun
给你 status=pending
和 rerun=null
searchR.php?status=pending&status=rerun
给出最后一个值status=rerun
searchR.php?status[]=pending&status[]=rerun
会给ayrrya $_GET['status'] = [pending,rerun];
发送页面
searchR.php?status=pending|rerun
接收页面
$Recordset1 = $_GET['status'];
$query = ("SELECT * FROM sampleOA WHERE status REGEXP '$Recordset1' ");
我使用"REGEXP"表达式来实现问题
中的objective
这个有效:
searchR.php?status=pending
这有效:
searchR.php?status=rerun
但这不是(仅列出 "pending"):
searchR.php?status=pending&rerun
我的目标是构建一个查询,该查询将列出来自两个术语("pending" 和 "rerun")的记录
URL 应该是什么样的?
使用符号向 url 引入新的变量和参数。例子
searchR.php?status=$pending&rerun=$running
searchR.php?status=pending&rerun
给你 status=pending
和 rerun=null
searchR.php?status=pending&status=rerun
给出最后一个值status=rerun
searchR.php?status[]=pending&status[]=rerun
会给ayrrya $_GET['status'] = [pending,rerun];
发送页面
searchR.php?status=pending|rerun
接收页面
$Recordset1 = $_GET['status'];
$query = ("SELECT * FROM sampleOA WHERE status REGEXP '$Recordset1' ");
我使用"REGEXP"表达式来实现问题
中的objective