如果有正确的结果,我需要回显一个下载按钮,但当我回显下载按钮时,它决定回显超过1.如何更正? 继承我的代码:
<?php
$u = $_SESSION["username"];
$getscripts = $conn->prepare("SELECT * FROM project_sa");
$getscripts->execute();
while ($row = $getscripts->fetch(PDO::FETCH_BOTH)) {
$sec = $conn->query('SELECT * FROM us WHERE username="wafflezzz"');
$sec->execute();
while ($rowx = $sec->fetch(PDO::FETCH_BOTH)) {
$checker = $rowx[$row["script_title"]];
if ($checker == $row["script_title"]) {
$geturl = $conn->prepare("SELECT * FROM project_sa WHERE script_title='$checker'");
$geturl->execute();
while ($row = $geturl->fetch(PDO::FETCH_BOTH)) {
echo '
<form method="post" action="dl.php">
<input name="bname" value="<?php echo $branded_m_img_url; ?>" hidden></input>
<input type="submit" class="ui huge button" value="Download"></input>
</form>';
}
}
}
}
?>
当数据库中只有1个条目时,它会返回大约2个已损坏的重复条目!
答案 0 :(得分:0)
&#34;你有嵌套的while循环,这就是为什么你得到重复的条目,你也在内部while循环中覆盖$ row - Alon Eitan昨天&#34;
在我解决之后,它起作用了!