Php > Arrays
How to display any array in several rows and columns of a table. Not just
How to display any array in several rows and columns of a table. Not just On each and every corner you find snippets on how to display every second row e.g. in a different color. But what, if you want to display a table with 6 rows and 6 colums in different colors? Here's the solution: $colors=ARRAY( "#000000","#000033","#000066","#000099","#0000CC","#0000FF","#003300", "#003333","#003366","#003399","#0033CC","#0033FF","#006600","#006633", "#006666","#006699","#0066CC","#0066FF","#009900","#009933","#009966", "#009999","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99", "#00CCCC","#00CCFF","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC", "#00FFFF"); ?>
for($i=0; $i< count($colors); $i++) { echo '
'; if ( (($i+1) % 6) == 0 ) echo $newrow="
"; // change 6 to 8 and see } ?>
If you replace the array of colors with any database generated value, you can generate a table of images like an album nicely without manually fiddling with the code.
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage