MySQLifetch_all的奇怪错误-WeirderrorwithMySQLifetch_all
作者:516837745_d2d52c | 来源:互联网 | 2023-05-19 01:59
Thisisprobablygoingtobemarkedasaduplicatebutmyerrorseemstobedifferentfromtheother
This is probably going to be marked as a duplicate but my error seems to be different from the others that I've seen here on stackoverflow.
这可能会被标记为重复,但我的错误似乎与我在stackoverflow上看到的其他错误不同。
the following code is supposed to display the content from the image: code:
以下代码应该显示图像中的内容:代码:
if($news_result = $db->query("SELECT * FROM `news` ORDER BY `likes` DESC LIMIT 4")) {
if ($news_result->num_rows) {
$rows = $news_result->fetch_all(MYSQL_ASSOC);
$row_count = 0;
foreach($rows as $row) {
$row_count++;
$content_echo = '
';
$separator = '
';
if ($news_result->num_rows > 1 && $row_count > 0 && $row_count <$news_result->num_rows) {
$content_echo .= $separator;
}
echo $content_echo;
}
}
}
Image:
'.$row['title'].'
'.$row['description'].' |
BY: '.$row['creator'].' |
READ MORE