How to display in html the data of all columns obtained through a mysql query?

Asked

Viewed 160 times

-2

I have a table with 1000 columns (example), how to display the content , of all columns of a row obtained through the "ID"?

SELECT * FROM `tabela_1000_colunas` WHERE id = 1;

After this select, how do I display in "html" the contents of these 1000 columns? Ex: column1 column2 column3...column999 column1000 date1 date2 date3 date999 date1000

  • 7

    It’s not the same question, a suggestion is to take the names of the fields through the array_keys() and make another foreach that itere this array, thus becomes dynamic.

1 answer

0

I display this way, see the code below:

echo'<table align ="center" class="bortpago" border="1" cellspacing="5" cellpadding="5">';

for($x=0;$x<1000;$x++) {   
  echo 
        '<tr bgcolor="#BEBEBE" >'
            .'<td>'                               
            .coluna[1]  
            .'</td>'
            .'<td>'
            .coluna[2]   
            .'</td>'
        .'</tr>';
}
  • 1

    $query = mysql_query("SHOW COLUMNS FROM paineladm_users"); while ($column = mysql_fetch_assoc($query)) { $column = $column["Field"]; echo "$column "; } mysql_close(); this code returns the 1000 column name automatically, I wanted instead of the column name the values of all columns in that row

Browser other questions tagged

You are not signed in. Login or sign up in order to post.