mattibutt
asked on
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
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']}\" />
";
Describe your desired format more explicitly. Draw a picture if you can.
ASKER
this is how it looks like currently
current.gif
current.gif
How do you want it to look?
ASKER
this is how i want to do
desired.gif
desired.gif
What if there are more than 4?
ASKER
in the current on there is a radio button but its not visible in the picture because of background
ASKER
hi buddy
they will only going to be four
they will only going to be four
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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($r ow['uniq_i d'])."\">< 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['arti st']."</td >
<td class=\"$col\"><a href=\"".makevideolinks($r ow['uniq_i d'])."\">" .$row['vid eo_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']}\" />
";
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\">
<tr>
<td align=\"center\" class=\"$col\" width=\"35\" ><a href=\"".makevideolinks($r
<td class=\"$col\" width=\"250\">".$row['arti
<td class=\"$col\"><a href=\"".makevideolinks($r
<input type=\"hidden\" name=\"compid_{$row['id']}
<input type=\"hidden\" name=\"userid_{$row['id']}
</tr>
<td class=\"$col\"> <input type=\"radio\" name=\"Vote\" value=\"{$row['uniq_id']}\
<input type=\"hidden\" name=\"compid_{$row['id']}
";
ASKER
i mean the current structure is like a table transforming it to your code i dont know where to begin
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;
ASKER
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($r ow['uniq_i d'])."\">< 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['arti st']."</di v>
<br />
<div class=\"$col\"><a href=\"".makevideolinks($r ow['uniq_i d'])."\">" .$row['vid eo_title'] ."</a></di v>
<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>";
}
$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\">
<tr>
<div class=\"container\">
<div class=\"item\">
<div class=\"itemwindow\">
<div align=\"center\" class=\"$col\" width=\"35\" ><a href=\"".makevideolinks($r
<br />
<div class=\"$col\" width=\"250\">".$row['arti
<br />
<div class=\"$col\"><a href=\"".makevideolinks($r
<br />
<div class=\"$col\"> <input type=\"radio\" name=\"Vote\" value=\"{$row['uniq_id']}\
<input type=\"hidden\" name=\"compid_{$row['id']}
<input type=\"hidden\" name=\"userid_{$row['id']}
</div>
";
$j++;
"</form>";
}
ASKER
thank you so much i really appreciate your help
ASKER
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
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
ASKER
before i create the question i will need your approval
Sure
ASKER
here is the links
https://www.experts-exchange.com/questions/24356108/poll-results-with-different-images.html
thanks
https://www.experts-exchange.com/questions/24356108/poll-results-with-different-images.html
thanks
ASKER