Hi Im trying to get mysql_query result with foreach set up and i am just planning what i am going to do but I am stuck with adding foreach into my code so far.
Basically F field has several different options which are duplicated lots of times, so i need the F field in the WHERE F
= to be foreach different option in that field. (HOpe I have explained OK)
If someone could help it would be great Thanks
<?php
$con = mysql_connect("localhost","X","X");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbname", $con);
$result = mysql_query("SELECT `A`, `B`, `C`, `D`, `E`, `F`, `G`, `H` FROM TABLE WHERE `F` = 'blar' ORDER BY `H`+0 DESC LIMIT 10") or trigger_error(mysql_error().$sql);
echo "<table cellspacing='0' cellpadding='0' class='altrowstable' id='alternatecolor' width='100%'>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
<th>E</th>
<th>F</th>
<th>G</th>
</tr>";
$n = 1;
while($row = mysql_fetch_array($result))
{
echo"<div id='tab_'.sprintf("%.0f",$n++).'' class='show parent' style='background-position:99.8% center; background-size: auto 100%; border-radius:0 0 3px 0; -moz-border-radius:0 0 3px 0; -webkit-border-radius:0 0 3px 0; -o-border-radius:0 0 3px 0; display: block;'>
<div class='col-3'>
<div class='table_view'>
<div class='table_info_head'>
<div class='info_table_outer'>
<div class="table_info'>
echo "<tr>";
echo '<td>' . $row['A'] . ' with other info></td>';
echo '<td>' . $row['B'] . ' with other info></td>';
echo '<td>' . $row['C'] . ' with other info></td>';
echo '<td>' . $row['D'] . ' with other info></td>';
echo '<td>' . $row['E'] . ' with other info></td>';
echo '<td>' . $row['F'] . ' with other info></td>';
echo '<td>' . $row['G'] . ' with other info></td>';
echo "</tr>";
}
echo "</table>";
echo "</div>
</div>
</div>
</div>
</div>
</div>";