gpt4 book ai didi

php - 我应该返回 4 个图像的正确 MySQL 查询只返回 3 个

转载 作者:行者123 更新时间:2023-11-29 05:59:28 25 4
gpt4 key购买 nike

<分区>

即使我在 phpMyAdmin SQL 选项卡中查询它时它工作正常。我想要完成的是显示用户上传的所有图像(目前是 4 张)但我只得到 3 张(缺少的总是第一个)。这是我的代码:

<?php

$currentUser = $_SESSION['id'];
$sql = "SELECT username FROM user WHERE id='$currentUser'";
$result = mysqli_query($conn, $sql);
$getResult = mysqli_fetch_assoc($result);
$author = $getResult['username'];

$sql2 = "SELECT * FROM image WHERE author='$author' ORDER BY id DESC";
$result2 = mysqli_query($conn, $sql2);
$getResult2 = mysqli_fetch_assoc($result2);

while ($row = $result2->fetch_assoc()){
echo '<a href="imageInfo.php?image='.$row["path"].'"><img class="profilePageImages" src="uploads/'.$row['path'].'" alt="Random image" /></a>';
}

?>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com