查询如下
$query = "SELECT password FROM passwordhistory where userid=? order by id desc limit 3";
$stmt2 = $mysqli->prepare($query);
$stmt2->bind_param('i',$id);
$stmt2->execute();
$res=$stmt2->get_result();
while($row=$res->fetch_object()) {
foreach($row as $t->password) {
echo $password[1];
}
}
在上面的代码中我想要打印三个变量的密码。我无法做到这一点。
答案 0 :(得分:1)
将您的代码更改为:
$i = 0;
while($row=$res->fetch_object())
{
foreach($row as $t->password)
{
echo $newPass.$i = $password[1];
$i++;
}
}
答案 1 :(得分:1)