I am very new to php and cant figure out how to take this code and output it so it displays 4 wide or four columns instead of one after the other straight down the page as it does now. Any help greatly appreciated.

I have searched but cant find anything specifically related to this example and being as new as I am I can't figure out how to implement similar ideas here in the forum.

Currently the echo "<div id='ezjax_content'> tag displays the output straight down the page i need that output to go 4 wide across the page then start a new line.

$rpp = 20; // results per page  "index.php?option=com_video&view=channelslist&sort=" .$sort. "";
$adjacents = 10;

$sort = $_GET["sort"];	

$page = intval($_GET["page"]);


if(!$page) $page = 1;

//$reload = $SERVER['PHP_SELF'];
$reload=JURI::root()."index.php?option=com_video&view=shows&format=raw&sort=" .$sort. "";


// Sorting Options:	
		if ($sort == 'rv') {		
		$sort = "room_viewers DESC";
		}
		if ($sort == 'mr') {		
		$sort = "sdate  DESC";		
		}	
		if ($sort == 'female') {		
		$sort = "gender DESC";
		$sort_f = "AND gender = 'female'";	
		}
		if ($sort == 'male') {		
		$sort = "gender DESC";
		$sort_f = "AND gender = 'male'";	
		}
		if ($sort == 'solo') {		
		$sort = "accessibility DESC";
		$sort_f = "AND accessibility = 0";	
		}
		if ($sort == 'couple') {		
		$sort = "accessibility DESC";
		$sort_f = "AND accessibility = 1";	
		}
		if ($sort == 'party') {		
		$sort = "accessibility DESC";
		$sort_f = "AND accessibility = 2";	
		}		
		else
		{
		$sort = "id  DESC";
		}

$db = &JFactory::getDBO();
// select appropriate results from DB:
$sql = "SELECT * FROM jos_vw_sessions where status='1' and type='1' and invite_only='0' $sort_f ORDER BY $sort ";
$result = mysql_query($sql);


// count total number of appropriate listings:
$tcount = mysql_num_rows($result);

// count number of pages:
$tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number

$count = 0;
$i = ($page-1)*$rpp;
while(($count<$rpp) && ($i<$tcount)) {
    mysql_data_seek($result,$i);
    $query = mysql_fetch_array($result);



// output each row: 

echo "<div id='ezjax_content'>
<a class='group' href='#".$query['username']."'><IMG width='230' SRC='components/com_videowhisperlivestreaming/snapshots/".$query['room'].".jpg' ALT='".$query['room'].($query['message']?": ".$query['message']:"")."'></a>																																
<div class='joinchat'>	
<div class='liveshowcontent'> 
<b>Live Started:</b> ".date("m.d.y - h:i:s A",$query['sdate'])."  <br>
<b>Online bikers:</b> ".$query['room_viewers']." <br>
<b>Room Onwer:</b> <a href='http://mysite.com/profile/".$query['username']."/'>".$query['username']."</a> </div>
</div>	
<div style='display:none' id='".$query['username']."'>																																															<p align='center' style='margin-bottom:5px'>
<a style='color:#cf5a0d;font-size:16px;text-decoration:none' onmouseover=\"this.style.color='#333'\"  onmouseout=\"this.style.color='#cf5a0d'\" href='http://mysite.com/profile/".$query['username']."/'><b>Enter Chat</b></a></p>
<object width='320' height='240'>
<param name='movie' value='components/com_videowhisperlivestreaming/live_video.swf?n=".$query['username']."'></param>
<param name='allowFullScreen' value='true'></param>
<param name='allowscriptaccess' value='always'></param>
<embed src='components/com_videowhisperlivestreaming/live_video.swf?n=".$query['username']."' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='320' height='240'></embed>
</object>
</div>
</div>";


$i++;
$count++;
}

// call pagination function:
include("pagination.php");
echo paginate_three($reload, $page, $tpages, $adjacents);

Thanks in advance
Brian๐Ÿ™‚

    ok getting closer it now output across instead of down but it is adding extra output code.

    Example I had two items outputted it pout the first tow wide across the page and then one under them.

    What am i missing?

    New code:

    $rpp = 20; // results per page  "index.php?option=com_video&view=channelslist&sort=" .$sort. "";
    $adjacents = 10;
    
    $sort = $_GET["sort"];	
    
    $page = intval($_GET["page"]);
    
    
    if(!$page) $page = 1;
    
    //$reload = $SERVER['PHP_SELF'];
    $reload=JURI::root()."index.php?option=com_video&view=shows&format=raw&sort=" .$sort. "";
    
    
    // Sorting Options:	
    		if ($sort == 'rv') {		
    		$sort = "room_viewers DESC";
    		}
    		if ($sort == 'mr') {		
    		$sort = "sdate  DESC";		
    		}	
    		if ($sort == 'female') {		
    		$sort = "gender DESC";
    		$sort_f = "AND gender = 'female'";	
    		}
    		if ($sort == 'male') {		
    		$sort = "gender DESC";
    		$sort_f = "AND gender = 'male'";	
    		}
    		if ($sort == 'solo') {		
    		$sort = "accessibility DESC";
    		$sort_f = "AND accessibility = 0";	
    		}
    		if ($sort == 'couple') {		
    		$sort = "accessibility DESC";
    		$sort_f = "AND accessibility = 1";	
    		}
    		if ($sort == 'party') {		
    		$sort = "accessibility DESC";
    		$sort_f = "AND accessibility = 2";	
    		}		
    		else
    		{
    		$sort = "id  DESC";
    		}
    
    $db = &JFactory::getDBO();
    // select appropriate results from DB:
    $sql = "SELECT * FROM jos_vw_sessions where status='1' and type='1' and invite_only='0' $sort_f ORDER BY $sort ";
    $result = mysql_query($sql);
    
    
    // count total number of appropriate listings:
    $tcount = mysql_num_rows($result);
    
    // count number of pages:
    $tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number
    
    $count = 0;
    $i = ($page-1)*$rpp;
    while(($count<$rpp) && ($i<$tcount)) {
        mysql_data_seek($result,$i);
        //$query = mysql_fetch_array($result);
    
    // set up loop counter
    $col_count = 0;
    
    // start table and first tr
    echo '<table><tr>';
    
    while ($query=mysql_fetch_array($result)) {
       // if you have output 3 cols then end tr and start a new one
       if ($col_count == 4) {
          echo '</tr><tr>';
          //  and reset the col count
          $col_count = 0;
       }
       // always output the td
       echo "<td><div id='ezjax_content'>
    <a class='group' href='#".$query['username']."'><IMG width='230' SRC='components/com_video/snapshots/".$query['room'].".jpg' ALT='".$query['room'].($query['message']?": ".$query['message']:"")."'></a>																																
    <div class='joinchat'>	
    <div class='liveshowcontent'> 
    <b>Live Started:</b> ".date("m.d.y - h:i:s A",$query['sdate'])."  <br>
    <b>Online bikers:</b> ".$query['room_viewers']." <br>
    <b>Room Onwer:</b> <a href='http://mysite.com/profile/".$query['username']."/'>".$query['username']."</a> </div>
    </div>	
    <div style='display:none' id='".$query['username']."'>																																															<p align='center' style='margin-bottom:5px'>
    <a style='color:#cf5a0d;font-size:16px;text-decoration:none' onmouseover=\"this.style.color='#333'\"  onmouseout=\"this.style.color='#cf5a0d'\" href='http://mysite.com/profile/".$query['username']."/'><b>Enter Chat</b></a></p>
    <object width='320' height='240'>
    <param name='movie' value='components/com_video/live_video.swf?n=".$query['username']."'></param>
    <param name='allowFullScreen' value='true'></param>
    <param name='allowscriptaccess' value='always'></param>
    <embed src='components/com_video/live_video.swf?n=".$query['username']."' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='320' height='240'></embed>
    </object>
    </div>
    </div></td>";
      // and count the column
      $col_count++;
    }
    
    // then close off the last row and the table
    echo '</tr></table>';  
    
    
    
    
    $i++;
    $count++;
    }
    
    // call pagination function:
    include("pagination.php");
    echo paginate_three($reload, $page, $tpages, $adjacents);
    		

      All sorted!

      You can close this out!

        You can do that yourself using the "Mark thread resolved" option under the "Thread Tools" menu.

          Write a Reply...