twistedindustries Posted March 22, 2008 Share Posted March 22, 2008 So I have a list of items and I need to make it so that they show in columns of 3 and an unlimited amount of rows here is the code i am working with: <?php $colsNbr = count( 3 ); foreach ( $columns as $column ) { echo "\t\t\t<th><b></b></th>\n"; } ?> </tr> <?php $i = 0; if (is_array($users) && count($users)>0) { foreach($users as $user) { $class = "sectiontableentry" . ( 1 + ( $i % 2 ) ); // evenodd class if($ueConfig['allow_profilelink']==1) { $style = "style=\"cursor:hand;cursor:pointer;\""; $style .= " id=\"cbU".$i."\"" ; // $style .= " onclick=\"javascript:window.location='".sefRelToAbs("index.php?option=com_comprofiler&task=userProfile&user=".$user->id.$option_itemid)."'\""; } else { $style = ""; } if ( $user->banned ) { echo "\t\t<tr class=\"$class\"><td colspan=\"".$colsNbr."\"><span class=\"error\" style=\"color:red;\">"._UE_BANNEDUSER." ("._UE_VISIBLE_ONLY_MODERATOR.") :</span></td></tr>"; } if ($i == 3) { echo "\t\t<tr>\n"; } foreach ( $columns as $column ) { echo "\t\t\t<td valign='top'>" . HTML_comprofiler::getUserListCell( $user, $column, $allFields, $option_itemid ) . "</td>\n"; if ($i == 3) { echo "\t\t</tr>\n"; } } echo "\t\n"; $i++; } } else { echo "\t\t<tr class=\"sectiontableentry1\"><td colspan=\"".$colsNbr."\">"._UE_NO_USERS_IN_LIST."</td></tr>"; } ?> Link to comment https://forums.phpfreaks.com/topic/97420-help-me/ Share on other sites More sharing options...
ohdang888 Posted March 22, 2008 Share Posted March 22, 2008 this is how i make my columns in my table... <table> <tr> <?php while($row2 = mysql_fetch_assoc($result)){ if ($x % 3 == 0) {// change the number to number of columns wanted echo '</tr><tr>'; } $x++; echo '<td>'; the info in each colum echo '</td>'; } ?> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498492 Share on other sites More sharing options...
marklarah Posted March 23, 2008 Share Posted March 23, 2008 Dude, I had the EXACT same problem. Heres my code (its a games thing, you will need to edit it to you obviosuly): <?php $dn = mysql_query("SELECT * FROM `3`") or die(mysql_error()); echo '<div class="bord"><table width="100%"><tr>'; $i = 0; while ($row = mysql_fetch_array($dn)){ echo '<td><center><a href="?p='.$row['ID'].'"><img src="'.$row['img'].'" width="130" height="105"><br>'.$row['name'].'</center></a></td>'; $i++; if ($i % 3 == 0 ){ echo '</tr><tr><td><hr></td><td><hr></td><td><hr></td></tr><tr>'; // Above there, i just liked hr's, if you dont want them, just change it to this line: echo '</tr><tr>'; } } echo '</tr></table></div>'; } ?> Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498521 Share on other sites More sharing options...
twistedindustries Posted March 23, 2008 Author Share Posted March 23, 2008 thanks for the effort but I couldn't get that to work for me. Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498522 Share on other sites More sharing options...
marklarah Posted March 23, 2008 Share Posted March 23, 2008 post your whole code Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498523 Share on other sites More sharing options...
twistedindustries Posted March 23, 2008 Author Share Posted March 23, 2008 Sorry it wouldn't let me post the whole thing so here is an image *** IMAGE REMOVED - PM SENT*** Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498551 Share on other sites More sharing options...
twistedindustries Posted March 23, 2008 Author Share Posted March 23, 2008 Would it help if I said the only code I was concerned with is the code between 860 and 891? Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498561 Share on other sites More sharing options...
uniflare Posted March 23, 2008 Share Posted March 23, 2008 i would just like to say, please, split your file into chunks, and include them. its easier to code, debug, post, read etc. also, fair play for making that image, i dont quite know how you did it, but it would probably be easier for any debugging gurus on here to have it as text so they can copy/paste into their own wysywig (dont know how to spell ), they may have their own colors or debugging options etc. - just upload the file we can all download it we definetely dont need all the code. ------- is this page on a website? can we see the output or can you tell us what it is doing now. since to me it looks like your question was answered by your the code you posted yourself (i probably just dont understand you lol) Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498580 Share on other sites More sharing options...
twistedindustries Posted March 23, 2008 Author Share Posted March 23, 2008 Thanks man, sorry I didn't quite know how to do that, I have never attempted to post 2000+ lines of code. FYI the program I used to make that is called SnagIt very handy little program I mainly like it because it has a function like mac (apple-shift-4) that allows you to screen shot regions of your screen. Anyway, here is a link to the zipped file: http://www.visionsminis.com/zipped.zip Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498592 Share on other sites More sharing options...
twistedindustries Posted March 23, 2008 Author Share Posted March 23, 2008 I thought your last question was your sig because of the ---- seperating it, anyway here is a link to the page http://visionsminis.com/CMS/index.php?option=com_comprofiler&task=usersList&listid=4&Itemid=6 Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-498829 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 anyone? Link to comment https://forums.phpfreaks.com/topic/97420-help-me/#findComment-499142 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.