Retrieve field names from a table
| From: | Alberto Brea | Date: | Wed, 30 Apr 2003 18:39:09 +0000 |
| Subject: | Retrieve field names from a table | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145839@lists.php.net to get a copy of this message | ||
I am trying to display a table from a checkboxed form (one checkbox for each
field), so the user can check certain fields to select the columns he
wishes.
However, I can't see how to retrieve the field names dynamically.
Could anybody please tell me how to do it?
This is what I have tried to do so far, probably with some elementary
mistake:
echo("<tr>");
$sql="DESCRIBE contacts";
$result=mysql_query($sql);
while($row = mysql_fetch_array($result)):
$field = $row["field"];
print("<td>$field</td>");
endwhile;
echo("</tr>");
Thanks
Alberto