gpt4 book ai didi

php - 第二个 MySQL 查询不起作用

转载 作者:行者123 更新时间:2023-11-29 04:13:46 25 4
gpt4 key购买 nike

检查这段代码:

            $select = mysql_query("SELECT * FROM nieuws ORDER BY id DESC LIMIT 1");
while($row = mysql_fetch_assoc($select)) {
$datum = $row['time'];
$titel = $row['title'];
$bericht = $row['message'];
?>
<div class="entry">

<span class="blue date"><?php echo "$datum"; ?></span>
<h3><?php echo "$titel"; ?></h3>
<p><?php echo "$bericht"; ?></p> <br />
</div><!-- end of entry --> <?php } ?>
<?php
$select2 = mysql_query("SELECT * FROM nieuws ORDER BY id DESC LIMI 1, 1");
while($row2 = mysql_fetch_assoc($select2)) {
$datum = $row2['time'];
$titel = $row2['title'];
$bericht = $row2['message'];
?>
<div class="entry">
<span class="green date"><?php echo "$datum"; ?> </span>
<h3><?php echo "$titel"; ?></h3>
<p><?php echo "$bericht"; ?></p>
</div> <!-- end of entry --> <?php } ?>
</div><!-- end of news -->

第一条新闻正确显示,到第二个我得到这个错误:

警告:mysql_fetch_assoc():提供的参数不是有效的 MySQL 结果资源

有什么问题?

最佳答案

SELECT * FROM nieuws ORDER BY id DESC LIMI 1, 1

应该是

SELECT * FROM nieuws ORDER BY id DESC LIMIT 1, 1

关于php - 第二个 MySQL 查询不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3280789/

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