|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
before beginning this is more of a simple script than a tutorial
so don't expect long explanations this was made in a spare of the moment thing example of how it wuld show Code:
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 this script allows you to have so many columns per row it can come in handy here is the code you will be using. PHP Code:
a little break down first bit of this code am showing you is another way of doing an ifelse statment so this ($i % $columns) ? $row = FALSE : $row = TRUE; is basicaly if($i % $columns) { $row = FALSE; } else { $row = TRUE; } normaly when your using this version of an ifelse statement it would go something like this. $me = ($_GET['me'] == 1) ? echo $_GET['me'] : echo 'sorry it does not == 1'; then you would echo $me; and it would either echo 1 or the other next part is simple if($i && $row) { echo '<tr></tr>';} $i++; which basicaly means if row exceeds columns limit then create another row after that you stick $i++ on then end which basicaly means "add 1 and return the value of i-1" or "return the value of i, then add 1 to it" when using this script you use it as shown PHP Code:
its pretty simple, easy and efficient i personally use this for the likes of rosters to show the users profile image and username. but what ever you think you can use it for enjoy p.s i appologies if this looks in anyways messy kind of a quick type don't have alot of time to sit down and go through it. but the script works with no problems because i'm using it
__________________
the best way to learn
1. check the site because it rules 2. search your functions up on php.net 3. surf the web google.com 4. lookup tutorials tutorialized.com |
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > Multicolumn Output from a Database with PHP a more efficient way |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|