In this scenario, you're encountering an issue where the mysqli_fetch_array function is combining all the column values into a single column, making it challenging to access them individually.
To resolve this, consider utilizing the following approach:
<code class="php">$posts = array(); while($row = mysqli_fetch_array($result)) { $posts[] = $row; }</code>
By storing the entire row as an element in the $posts array, you can access individual values later using a nested loop:
<code class="php"><?php foreach ($posts as $row) { foreach ($row as $element) { echo $element . "<br>"; } } ?></code>
This will print all values in the columns, one per line. Alternatively, you can also access specific elements directly using the array index:
<code class="php">$postId = $row[0];</code>
The above is the detailed content of How to Separate MySQL Column Values Using mysqli_fetch_array?. For more information, please follow other related articles on the PHP Chinese website!