Php > Look and Feel
Multi Column Output
Multi Column Output
Output to 2 columns
//you need this - it tells the data what collumn to go to $count = 1; $column = 1; //db connect and select $link = mysql_connect( "localhost", "root", "password" ); mysql_select_db( "dbname" ); $result=mysql_query ("select * from table_name"); //loop statement while ($myrow = mysql_fetch_array ($result)) { // this is the column 1 if ($column == 1) { printf("
$count
%s
",$myrow[value]); } else{ //this is the column 2 printf("
$count
%s
",$myrow[value]); } //increment the count $count += 1; // this is a modulus operator it gets the remainder of the equation $column = $count % 2; } ?>
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