Skip to content
Advertisement

mysqli_fetch_array returning only one result

I’m trying to make a very, very simple query of a small mysql database, using the following code (with appropriate values in $host, etc.):

JavaScript

As you can see, I printed out the results in a human-readable way, yielding:

JavaScript

There are a few example universities in that column, so I’m not sure what I’m doing wrong.

Advertisement

Answer

mysqli_fetch_array works by pointers each time it’s called

Imagine the following

JavaScript

To actually display the data the way you want it to, I suggest you do the following

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement