It should be pretty simple, but I can't get it to work. I have this code to repeat the mysqli query:
while($row = mysqli_fetch_array($result)) { $posts[] = $row['post_id'].$row['post_title'].$row['content']; }
It works and returns:
Variable # 1: (array, 3 elements) ↵ 0 (String): "4testtest" (9 characters) 1 (String): "World of Japan! Welcome to WordPress. This is your first post. Edit or delete it, and then start blogging! " (99 characters) 2 (String): "2Sample PageThis is an example page. It differs from a blog entry because it will remain in one place and appear in the site navigation (in most topics)." (161 characters)
The problem is that it puts all three columns in one column, so I cannot access them separately.
This is for example:
0 (String): "4testtest" (9 characters)
Must be divided by 4, check, test
When I do this:
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']; }
It prints only 1 line instead of all three ...
Any help is much appreciated!
source share