Piggybacking on Nicola's answer with some readable php
$a = mysqli_query($conn,"select * from information_schema.columns
where table_schema = 'your_db'
order by table_name,ordinal_position");
$b = mysqli_fetch_all($a,MYSQLI_ASSOC);
$d = array();
foreach($b as $c){
if(!is_array($d[$c['TABLE_NAME']])){
$d[$c['TABLE_NAME']] = array();
}
$d[$c['TABLE_NAME']][] = $c['COLUMN_NAME'];
}
echo "<pre>",print_r($d),"</pre>";