what's the best way to:
1. retrieve all data in a table
2. display the data retrieved so that it looks as it is stored.
best method to get all data
Moderator: General Moderators
-
jaymoore_299
- Forum Contributor
- Posts: 128
- Joined: Wed May 11, 2005 6:40 pm
- Contact:
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
SELECT * FROM `table` [*]a standard html table works well. For the most part, you can blindly display each column in a cell. The only real check you may want to do is check if a field is NULL. You can use [url=http://php.net/function.array_keys]array_keys()[/url] with the result from [url=http://php.net/function.mysql_fetch_assoc]mysql_fetch_assoc()[/url] to display the field names as the table header. Alternately, you can do a [url=http://dev.mysql.com/doc/mysql/en/describe.html]DESCRIBE[/url] to do some proportional calculations and type setting to fiddle with how it looks.[/list]