For example, we get an array of posts from our test database:
//create a database connection $conn = mysqli_connect('localhost', 'root', 'password', 'testdb'); //get data from the table of posts $posts = mysqli_query($conn, "SELECT * FROM `posts`"); //convert the data into a php array using the function mysqli_fetch_all() $posts = mysqli_fetch_all($posts);
Now on our data we have available operations that are available with the usual array:
foreach ($posts as $post) { echo $post[0]; }