i wanna show some companies by this condition that their flag is 'Y'.
then from these companies show randomly one products of them. and after refreshing again another product, i mean one company with one random product each refresh. but now the result is:
companies with Y flag without their products, products comes from just the first company.
thanks in advance
$query="select id, name from company where flag='y'";
$rs['create'] = true;
$total_comp=Util::executeQuery($query,$rs);
$row_Per_Column = $total_comp/2;
for($j=0;$j<$row_Per_Column;$j++){
echo "<tr>";
for($i=1;$i <= 2;$i++){
echo "<td bgcolor='' align='center'>"; if($row = array_shift($rs)){
$idco=$row['id'];
$name=$row['name'];
$query2="select id,name,thumbnail from product where com_id=$idco order by Rand()";
$rs2['create'] = true;
$result2=Util::executeQuery($query2,$rs2);
echo "<td bgcolor='' align='center'>";
if($row2 = array_shift($rs2)){
$id=$row2['id'];
$pname=$row2['name'];
$img = "images/products/small/".$row2['thumbnail'];
echo "<table STYLE='BORDER:1PX double #B7B7B6' bgcolor='' border='0' cellpadding='2' cellspacing='2' width='162' height='195'>".
"<tr><td colspan='3' align='center' height=''bgcolor='' ><a class='pulse_detail' href=\"".$page_Location."Product.php?id=".$id."\"><b>".$pname."</b></a></td></tr>".
"<tr><td> </td><td align='center'><a href=\"".$page_Location."Product.php?id=".$id."\">".
"<img width='90' height='117' alt ='".$pname."' src='".$img."' border='0'></a></td><td> </td></tr>".
"<td colspan='3'align='center'><a class='pulse' href=\"".$page_Location."ProductOfCompany.php?id=".$idco."\">other product of ".$name."</a>".
"<br/><br/><a href='pages/Product.php?id=".$row2['id']."'><img src='images/prodbuy.gif'align='middle' border='0'/></a></td></tr></table><br>";
} }
echo"</td>";
}
echo "</tr>";
}