I want to select a table from my SQL database. There may be many different columns in this table as I am compiling a dynamic query.
How to rewrite mine fetch_arrayin dynamic number of columns? Here is my current code:
$q = $db_object->query($query);
$returnstring = '';
while($r = $q->fetch_array()){
$returnstring .= '<tr>';
$returnstring .= '<td>'.$r.'</td>';
$returnstring .= '</tr>';
}
In a query, for example, two, three, four or more columns of a table appear.
Is it possible to do foreachor something like this?
source
share