I have (what seems like it should be) a simple looping problem.
I'm pulling three rows out of a database to create 3 featured boxes on my site. Each of the three boxes has should have a different <div> element applied it it (featuredLeft, featuredCenter, featuredRight). I'm using a while loop to populate my three tables but I can't figure out how to cycle through the three <div> elements within that while loop.
Here is what I have so far. The while loop works but all three tables have "featuredRight" as the <div> id.
$query_featured = "SELECT * FROM cards where featured = 'Y' LIMIT 3";
$result_featured = mysql_query($query_featured, $conn) or die('Error, this query failed');
$choose_style = array ('featuredLeft', 'featuredCenter', 'featuredRight');
while($featured_row = mysql_fetch_array($result_featured)) {
for ($i = 0; $i < 3; $i++) {
$featured_style = $choose_style[$i];
}
echo '<div id="'.$featured_style.'">' . PHP_EOL;
echo '<table width="225" height="126" cellpadding="0" cellspacing="1" bgcolor="BBCD7D" align="center">' . PHP_EOL;
echo '<tr>' . PHP_EOL;
echo '<td><div align="center"><a href="http://valuecreditcard.at/ukoffer?CTY=1&CID=2303"><img src="'.$featured_row[feat_img_link].'"></a>' . PHP_EOL;
echo ' </div>' . PHP_EOL;
echo '</td>' . PHP_EOL;
echo '</tr>' . PHP_EOL;
echo '<tr>' . PHP_EOL;
echo '<td><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">0%
interest on Purchases and Balance Transfers for 6 months.
16.9% APR variable typical.</font></div>' . PHP_EOL;
echo '</td>' . PHP_EOL;
echo '</tr>' . PHP_EOL;
echo '</TABLE>' . PHP_EOL;
echo '</div>' . PHP_EOL;
}
As always, any help is much appreciated.
Scott