I have the following table, called test, in MySQL
:
Now I would like to retrieve this data in PHP
, but I can't clarify my idea about the most correct way to do it. That is, I am not supposed to know how many rows or fields the table has, but based on what is obtained, I paint a table in PHP with that data.
What would be the correct way to do it?
Proof:
In $db you configure the connection. With the if you check connection errors and in the $result variable you store the result of executing the query. (The table and the configuration data have to be adapted to what you have configured)
Adapted from: http://php.net/manual/es/mysqli.real-query.php