Hi
I am trying to display the records Horizontally from my 3 different table
1. place table - n number of place
2. Item name
3. Item in different place
i want to display the above report as in the attachment.
please help me to resolve the issue
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="56" height="30" align="center">S.No</th>
<th width="445">Description</th>
<th width="102">Units</th>
<?php $qsite = "select * from sitename order by sitename"; $rsite = mysql_query($qsite,$conn); while($msite = mysql_fetch_array($rsite)){ $assite = $msite['sitename'];?>
<th width="91"><?php echo $msite['sitename']; ?></th>
<?php } ?>
<th width="244">Total</th>
</tr>
</thead>
<tbody>
<?php
$qsite = "select *,count(sitename) from sitename";
$rsite = mysql_query($qsite,$conn);
while($msite = mysql_fetch_array($rsite))
{
$assite = $msite['sitename'];
$asscount = $msite['count(sitename)'];
$qasset = "select * from asset_master_subcat";
$i=1;
//echo $qasset;
$rasset = mysql_query($qasset,$conn);
while($masset = mysql_fetch_array($rasset))
{
$asscode = $masset['ass_sub_cat_code'];
$asite = "select *,sum(no_of_qty),sum(transfer_qty) from assetinsite where ass_sub_cat_code='$asscode' and sitename='$assite'";
//echo $asite;
$asiter = mysql_query($asite,$conn);
?>
<tr class="light">
<td height="30" align="center" valign="middle"><?php echo $i;?></td>
<td width="445"><?php echo $masset['ass_sub_cat_name']; ?></td>
<td width="30"><?php echo $masset['unit']; ?></td>
<td>
<?php while($asitem = mysql_fetch_array($asiter))
{
$qtyno = $asitem['sum(no_of_qty)'];
$qtytrans = $asitem['sum(transfer_qty)'];
$total_qty = $qtyno + $qtytrans;?><?php echo $total_qty."\t "; } ?></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<?php $asstotalq = "select sum(no_of_qty),sum(transfer_qty) from assetinsite where ass_sub_cat_code='$asscode'";
//echo $asstotalq;
$asstotalr = mysql_query($asstotalq,$conn);
while($asstotalm = mysql_fetch_array($asstotalr))
{
$totalqty = $asstotalm['sum(no_of_qty)'];
$totaltrans = $asstotalm['sum(transfer_qty)'];
?>
<td><?php echo $total = $totalqty+$totaltrans;}?></td>
</tr><?php $i++;} }?>
</tbody>
</table>