Skip to content
Advertisement

MySQLI Fetch Database Column

I have database table options, where am using it as a dedicated table to store information. I have never heard of this type of table query and have never tried it. I saw on WordPress database so thought to try my own.

Here’s database table

enter image description here

This is what am trying now

JavaScript

This is inside my database class file $db

JavaScript

The Problem

When I var_dump the results, I don’t see any database information.

enter image description here

Advertisement

Answer

Since you want to get an array that shows the query results, I would try this:

JavaScript

Of course, this works in procedural style, too:

JavaScript

Go to the php documentation to learn more about mysqli_result::fetch_all.

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