如果我想从条目中获取多个值,例如id = $serchid
工作正常,但如果有很多人拥有相同的等级,我如何获得我的价值观?
这就是我所拥有的,但它仅适用于一个条目:
$rank = 7;
if(isset($_POST['submit'])) {
$dbcon = mysqli_connect("localhost", "root", "", "table");
$sql = "SELECT id, name FROM user WHERE rank = '$rank'";
$row = mysqli_fetch_row(mysqli_query($dbcon, $sql));
$id = $row[0];
$name = $row[1];
}
答案 0 :(得分:0)
$rank = 7;
if(isset($_POST['submit'])) {
$dbcon = mysqli_connect("localhost", "root", "", "table");
$sql = "SELECT id, name FROM user WHERE rank = '$rank'";
$qry = mysqli_query($dbcon , $sql );
if (!$qry){
die($query);
}
$result = array();
while ($row = mysqli_fetch_assoc($qry)) {
$result[] = $row;
}