moonxx Posted February 21, 2014 Share Posted February 21, 2014 Hi Can some one point me in right direction, My website displays 3 feature ads randomly and I want to show 3 in a row with unlimited rows on one page. how can I do this. the code I have on page is like this: function featured_ads() { //get the featured listings $q1 = "select * from class_catalog, class_categories where class_catalog.CategoryID = class_categories.CategoryID and class_catalog.FeaturedStatus = '1' order by rand() limit 0,3 "; $r1 = mysql_query($q1) or die(mysql_error()); if(mysql_num_rows($r1) > '0') { $FeaturedAds .= "<table align=center width=770 cellspacing=0 cellpadding=0 background=\"images/img_17.gif\" border=0><tr>\n\t<td colspan=3 align=left valign=top height=44 align=center valign=top><img src=\"images/img_20a.gif\" height=44 width=770></td>\n</tr>\n\n<tr>\n\t"; while($a1 = mysql_fetch_array($r1)) { $FeaturedAds .= "<td width=255 align=center>\n\n\t\t"; $FeaturedAds .= "<table align=center width=220 cellspacing=0 border=1 bordercolor=336699 rules=rows>\n\t\t<tr>\n\t\t"; if(!empty($a1[images])) { $ShowImage = explode("|", $a1[images]); $MyText = substr($a1[ProductName], 0, 65)."..."; $FeaturedAds .= "<td width=100 height=96 align=center valign=top><img src=\"images/$ShowImage[0]\" width=100 height=96></td>\n\n\t\t<td width=120 height=96 valign=top><a class=BlackLink href=\"info.php?id=$a1[ProductID]\">$MyText</a></td>\n\t\t</tr>\n\t\t"; } else { $MyText = substr($a1[ProductName], 0, 170)."..."; $FeaturedAds .= "<td width=220 height=100 align=center valign=top><a class=BlackLink href=\"info.php?id=$a1[ProductID]\">$MyText</a></td>\n\t\t</tr>\n\t\t"; } $FeaturedAds .= "</table>\n\n\t"; $FeaturedAds .= "</td>\n\n\t"; $fa++; } for($fe = '1'; $fe <= (3 - $fa); $fe++) { $FeaturedAds .= "<td width=255> </td>\n\t"; } $FeaturedAds .= "</tr>\n\n"; $FeaturedAds .= "<tr>\n\t<td colspan=3 align=center valign=top height=17 align=center valign=top><img src=\"images/img_23.gif\" height=17 width=770></td>\n</tr>\n\n"; $FeaturedAds .= "</table>\n\n"; return $FeaturedAds; } } Quote Link to comment https://forums.phpfreaks.com/topic/286384-gallery-page/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.