displaying records next to each other in the same place

hi
i have a php function which loads data from database it display each record as one row i want to change the format i want to display record next to each other instead of typical tablei want to display each record next to each other without table
$sql = "SELECT uniq_id, artist, video_title, yt_views, added FROM pm_videos_comp" ; 
		// NEW ITEM //
			$result = mysql_query($sql); 
			$item = '';
			$j = '1';
			$alt = '0';
		 
			while ($row = mysql_fetch_array($result))
				{ 
					$col = ($alt % 2) ? 'row1' : 'row2';
					$alt++;
					$item .= "
			
			<form method=\"post\" action=\"compsvideo.php\">\n
					  <tr>
					  
					    <td align=\"center\" class=\"$col\" width=\"35\" ><a href=\"".makevideolinks($row['uniq_id'])."\"><img src=\"".show_thumbs($row['uniq_id'])."\" alt=\"".$row['video_title']."\" class=\"tinythumb\" width=\"172\" height=\"173\" align=\"left\" border=\"1\" /></a></td>
						<td class=\"$col\" width=\"250\">".$row['artist']."</td>
						<td class=\"$col\"><a href=\"".makevideolinks($row['uniq_id'])."\">".$row['video_title']."</a></td>
 
					<input type=\"hidden\" name=\"compid_{$row['id']}\" value=\"{$row['compid']}\" />
<input type=\"hidden\" name=\"userid_{$row['id']}\" value=\"{$row['userid']}\" />
					  </tr>
					 <td class=\"$col\"> <input type=\"radio\" name=\"Vote\" value=\"{$row['uniq_id']}\" />
					<input type=\"hidden\" name=\"compid_{$row['id']}\" value=\"{$row['userid']}\" />
					
					 
	";

Open in new window

LVL 11
mattibuttAsked:
Who is Participating?
 
Steve BinkConnect With a Mentor Commented:
Try something like this:
<style>
  div#container {
    width:550px;
    height:140px;
    border:solid black 1px;
    padding:6px;
  }
  div.item {
    width:90px;
    min-width:90px;
    height:80px;
    min-height:80px;
    border:dotted black 2px;
    margin:12px;
    float:left;
  }
  div.itemwindow {
    width:66px;
    height:53px;
    border:solid black 1px;
  }
  div.clearfix { clear:both; }
</style>
 
<div id="container">
  <div class="item">
    <center><div class="itemwindow">#1</div><input type="radio" /></center>
  </div>
  <div class="item">
    <center><div class="itemwindow">#2</div><input type="radio" /></center>
  </div>
  <div class="item">
    <center><div class="itemwindow">#3</div><input type="radio" /></center>
  </div>
  <div class="item">
    <center><div class="itemwindow">#4</div><input type="radio" /></center>
  </div>
  <div class="clearfix">&nbsp;</div>
  Other stuff down here
</div>

Open in new window

0
 
mattibuttAuthor Commented:
is everyone on holidays i am not getting response to my questions is there any problem with EE website?
0
 
Steve BinkCommented:
Describe your desired format more explicitly.  Draw a picture if you can.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mattibuttAuthor Commented:
this is how it looks like currently
current.gif
0
 
Steve BinkCommented:
How do you want it to look?
0
 
mattibuttAuthor Commented:
this is how i want to do
desired.gif
0
 
Steve BinkCommented:
What if there are more than 4?
0
 
mattibuttAuthor Commented:
in the current on there is a radio button but its not visible in the picture because of background
0
 
mattibuttAuthor Commented:
hi buddy
 they will  only going to be four
0
 
mattibuttAuthor Commented:
hi buddy
thanks for that thing is all the data is coming from the database how do i apply your code on the following some guideline would be much appreciated

$sql = "SELECT uniq_id, artist, video_title, yt_views, added FROM pm_videos_comp" ;
                // NEW ITEM //
                        $result = mysql_query($sql);
                        $item = '';
                        $j = '1';
                        $alt = '0';
                 
                        while ($row = mysql_fetch_array($result))
                                {
                                        $col = ($alt % 2) ? 'row1' : 'row2';
                                        $alt++;
                                        $item .= "
                       
                        <form method=\"post\" action=\"compsvideo.php\">\n
                                          <tr>
                                         
                                            <td align=\"center\" class=\"$col\" width=\"35\" ><a href=\"".makevideolinks($row['uniq_id'])."\"><img src=\"".show_thumbs($row['uniq_id'])."\" alt=\"".$row['video_title']."\" class=\"tinythumb\" width=\"172\" height=\"173\" align=\"left\" border=\"1\" /></a></td>
                                                <td class=\"$col\" width=\"250\">".$row['artist']."</td>
                                                <td class=\"$col\"><a href=\"".makevideolinks($row['uniq_id'])."\">".$row['video_title']."</a></td>
 
                                        <input type=\"hidden\" name=\"compid_{$row['id']}\" value=\"{$row['compid']}\" />
<input type=\"hidden\" name=\"userid_{$row['id']}\" value=\"{$row['userid']}\" />
                                          </tr>
                                         <td class=\"$col\"> <input type=\"radio\" name=\"Vote\" value=\"{$row['uniq_id']}\" />
                                        <input type=\"hidden\" name=\"compid_{$row['id']}\" value=\"{$row['userid']}\" />
                                       
                                         
        ";
0
 
mattibuttAuthor Commented:
i mean the current structure is like a table transforming it to your code i dont know where to begin
0
 
NerdsOfTechTechnology ScientistCommented:
Try this
$sql = "SELECT uniq_id, artist, video_title, yt_views, added FROM pm_videos_comp" ; 
// NEW ITEM //
$result = mysql_query($sql); 
$item = '';
$j = '1';
$alt = '1';
 
$item .= "<form method=\"post\" action=\"compsvideo.php\">";
$item .= "<table><tr>";
while ($row = mysql_fetch_array($result))
{ 
 $col = ($alt % 2) ? 'row1' : 'row2';
 $item .= "
  <td>
  \n
                                           
  <div align=\"center\" class=\"$col\" width=\"35\" ><a href=\"".makevideolinks($row['uniq_id'])."\"><img src=\"".show_thumbs($row['uniq_id'])."\" alt=\"".$row['video_title']."\" class=\"tinythumb\" width=\"172\" height=\"173\" align=\"left\" border=\"1\" /></a></div>
  <br />
  <div class=\"$col\" width=\"250\">".$row['artist']."</div>
  <br />
  <div class=\"$col\"><a href=\"".makevideolinks($row['uniq_id'])."\">".$row['video_title']."</a></div>
  <br />
  <div class=\"$col\"> <input type=\"radio\" name=\"Vote\" value=\"{$row['uniq_id']}\" /></div> 
 
  <input type=\"hidden\" name=\"compid_{$row['id']}\" value=\"{$row['compid']}\" />
  <input type=\"hidden\" name=\"userid_{$row['id']}\" value=\"{$row['userid']}\" />
  </td>                                                                                
 ";
 $alt++;
}
$item .= "<td><input type="submit" value="Vote"></td>";
$item .= "</tr></table>";
 
echo $item;

Open in new window

0
 
mattibuttAuthor Commented:
thanks buddy it looks promising not the last though however the previous one you sent me i have sat down and tried to make it work problem is thought i am using the smarty templates as well this is fucking with my head but it seems promising this is what i done i put your css in my main css class then put the following codes videos are displayed next to each other although i need to clean the format but the goal has been met
$sql = "SELECT uniq_id, artist, video_title, yt_views, added FROM pm_videos_comp" ;
// NEW ITEM //
$result = mysql_query($sql);
$item = '';
$j = '1';
$alt = '1';
 
$item .= "<form method=\"post\" action=\"compsvideo.php\">";
$item .= "<table><tr>";
while ($row = mysql_fetch_array($result))
{
 $col = ($alt % 2) ? 'row1' : 'row2';
 $item .= "
  <td>
  \n
                  
                  <form method=\"post\" action=\"compsvideo.php\">\n
                                <tr>
                                <div class=\"container\">
                                 <div class=\"item\">
                                 <div class=\"itemwindow\">
                                  <div align=\"center\" class=\"$col\" width=\"35\" ><a href=\"".makevideolinks($row['uniq_id'])."\"><img src=\"".show_thumbs($row['uniq_id'])."\" alt=\"".$row['video_title']."\" class=\"tinythumb\" width=\"172\" height=\"173\" align=\"left\" border=\"1\" /></a></div>
  <br />
  <div class=\"$col\" width=\"250\">".$row['artist']."</div>
  <br />
  <div class=\"$col\"><a href=\"".makevideolinks($row['uniq_id'])."\">".$row['video_title']."</a></div>
  <br />
  <div class=\"$col\"> <input type=\"radio\" name=\"Vote\" value=\"{$row['uniq_id']}\" /></div>
 
  <input type=\"hidden\" name=\"compid_{$row['id']}\" value=\"{$row['compid']}\" />
  <input type=\"hidden\" name=\"userid_{$row['id']}\" value=\"{$row['userid']}\" />
                              
      </div>                        
      ";
      
      
      
                              $j++;
                              "</form>";
                        }
0
 
mattibuttAuthor Commented:
thank you so much i really appreciate your help
0
 
mattibuttAuthor Commented:
hi NerdsOfTech

you always come like a commando in the end to rescue i have been looking for you i have one problem which i cant seem to ressolve if i can paste a link after creating the question if you kindly look at it. thanks

0
 
mattibuttAuthor Commented:
before i create the question i will need your approval
0
 
NerdsOfTechTechnology ScientistCommented:
Sure
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.