gpt4 book ai didi

php - mysqli_fetch_array while 循环列

转载 作者:可可西里 更新时间:2023-11-01 13:04:53 27 4
gpt4 key购买 nike

<分区>

应该是非常基本的,但我无法让它工作。我有这段代码来遍历 mysqli 查询:

while($row = mysqli_fetch_array($result)) {
$posts[] = $row['post_id'].$row['post_title'].$row['content'];
}

有效并返回:

Variable #1: (Array, 3 elements) ↵ 0 (String): "4testtest" (9 characters) 1 (String): "1Hello world!Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!" (99 characters) 2 (String): "2Sample PageThis is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes)." (161 characters)

问题是它将所有三个列放在一个列中,所以我无法单独访问它们。

例如:

0 (String): "4testtest" (9 characters)

应该分成4,测试,测试

当我这样做时:

while($row = mysqli_fetch_array($result)) {             
$posts['post_id'] = $row['post_id'];
$posts['post_title'] = $row['post_title'];
$posts['type'] = $row['type'];
$posts['author'] = $row['author'];
}

它只输出 1 行而不是所有三行......

非常感谢任何帮助!

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