twistedindustries Posted March 24, 2008 Share Posted March 24, 2008 The question I have pertains to the code on lines 860-891. I simply want to display the information in three columns per row rather than one, how do I do this? Here is the file: http://www.visionsminis.com/zipped.zip 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/97563-is-there-a-way-to-make-this-display-in-columns/ Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Share Posted March 24, 2008 my example earlier should have worked just fine... <table class="new_games"><!-- the Hold Table--> <tr><td> <?php mysql_select_db("picture") or die(mysql_error()); $result = mysql_query("SELECT * FROM table ORDER BY date_added DESC LIMIT 6")or die(mysql_error()); $x = 0; echo '<table><tr>';// the picture table while($row2 = mysql_fetch_assoc($result)){ if ($x % 3 == 0) { echo '</tr><tr>'; } $x++; echo '<td>'; echo '<a href="game.php?title=';// start of picture echo $row2['title'].'">'; echo '<IMG SRC="picture/'; echo $row2['game_picture_url']; echo '"'.' WIDTH="90"'.' HEIGHT="90">'.'</a>'.'<br>';//end of poicture echo '<a href ="page.php?car=';//start of link code echo $row2['car']; echo '">'; echo $row2['title']; echo '</a></br>;// end of link code echo '</td>'; } ?> </tr> </table><!-- End icture table --> </td></tr> </table><!-- End hold table --> Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499189 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 I guess I don't understand how to incorporate the code is there anyway that you can show me? Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499190 Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Share Posted March 24, 2008 well then you have to post your current code. now. Because its in the wee hours of the night where i am, and i'm going to bed in a few minutes. Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499191 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 <?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>"; } 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"; 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/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499193 Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Share Posted March 24, 2008 wow i have no idea what that is even saying.... Are you using a database?, a db is by far the easiest way Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499194 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 yes I am using a database. I am so lost on how this code works as well. Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499196 Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Share Posted March 24, 2008 well then completely drop it.... is each picture info in a seperate row, or all in the same row? We can solve this a lot faster.... do you have AIM mine is: ohdang10 Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499197 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 no i don't have AIM sorry, and no its set up so that each one is between a <tr> tag Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499199 Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Share Posted March 24, 2008 nooo. i mean in the database table. Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499201 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 each one is in its own row Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499202 Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Share Posted March 24, 2008 Then my code works fine. just adapt the ['column'] to whatever needed. <?php //contect to db mysql_select_db("picture") or die(mysql_error());//select db $result = mysql_query("SELECT * FROM table LIMIT 6")or die(mysql_error()); $x = 0; echo '<table><tr>';// the picture table while($row = mysql_fetch_assoc($result)){ if ($x % 3 == 0) {// THIS IS WHAT YOU WANT. DON'T CHANGE THIS echo '</tr><tr>'; } $x++; echo '<td>'; echo '<a href="game.php?title=';// start of picture echo $row['title'].'">'; echo '<IMG SRC="picture/'; echo $row['game_picture_url']; echo '"'.' WIDTH="90"'.' HEIGHT="90">'.'</a>'.'<br>';//end of poicture echo '<a href ="page.php?car=';//start of link code echo $row['car']; echo '">'; echo $row['title']; echo '</a></br>;// end of link code echo '</td>'; } ?> </tr> </table><!-- End picture table --> Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499203 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 Im sorry but I can't get that to work it gives me an error for line 911 Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499204 Share on other sites More sharing options...
twistedindustries Posted March 24, 2008 Author Share Posted March 24, 2008 screw it I figured out a way it may not be the best but it works and that is all i need right now Link to comment https://forums.phpfreaks.com/topic/97563-is-there-a-way-to-make-this-display-in-columns/#findComment-499208 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.