php - can not print whole record with use of for each loop -


my template file try print fetch records data base problem select query working in front cant print whole records in result print first record mistake can me

    <table id="example" class="cell-border" cellspacing="0" width="100%" border="1">       <tr>         <td>edit</td>         <td>particular</td>         <td>date</td>         <td>rate</td>         <td>diff</td>         <td>diff amount</td>         <td>total</td>         <td>k.g.</td>         <td>total amount</td>         <td>javak date</td>         <td>javak fine</td>         <td>javak amount</td>         <td>aavak date</td>         <td>aavak fine</td>         <td>aavak amount</td>       </tr>       {foreach from=$clientdetail item=onerow}        <input type="hidden" name="clientid" value="{$onerow.clientid}">          <td><a href="client.php?clientid={$onerow.clientid}"><img src="img/edit.png"></a></td>          <td>{$onerow.particular}</td>          <td>{$onerow.cdate}</td>          <td>{$onerow.rate}</td>          <td>{$onerow.diff}</td>          <td>{$onerow.diffamt}</td>          <td>{$onerow.total}</td>          <td>{$onerow.kg}</td>          <td>{$onerow.totalamt}</td>          <td>{$onerow.javkdate}</td>          <td>{$onerow.javkfine}</td>          <td>{$onerow.javakamt}</td>          <td>{$onerow.avakdate}</td>          <td>{$onerow.avakfine}</td>          <td>{$onerow.avakamt}</td>       </tr>       {/foreach}     </table>     </form>     {/block} 

this select query

<?php include("include/config.inc.php"); if(!isset($_session['s_activid'])) {   $_session['s_urlredirectdir'] = $_server['request_uri'];   header("location:checklogin.php"); } else {     $partyid = isset($_request['partyid']) ? $_request['partyid'] : 0;      $k = 0;     $clientdetail = array();     $selectclient = "select * client                      partyid = ".$partyid;     $selectclientres = mysql_query($selectclient);     while($clientrow = mysql_fetch_array($selectclientres))     {       $clientdetail[$k]['clientid']     = $clientrow['clientid'];       $clientdetail[$k]['particular']   = $clientrow['particular'];       $clientdetail[$k]['clitranstype'] = $clientrow['clitranstype'];       $clientdetail[$k]['cdate']        = date('d-m-y',strtotime($clientrow['cdate']));       $clientdetail[$k]['rate']         = $clientrow['rate'];       $clientdetail[$k]['diff']         = $clientrow['diff'];       $clientdetail[$k]['diffamt']      = $clientrow['diffamt'];       $clientdetail[$k]['total']        = $clientrow['total'];       $clientdetail[$k]['kg']           = $clientrow['kg'];       $clientdetail[$k]['totalamt']     = $clientrow['totalamt'];         $selectcr = "select rojmeldate javkdate,fine javkfine,amount javakamt                          rojmel                    rojtranstype = 'j'                   , partyid = ".$partyid;       $selectcrres = mysql_query($selectcr);       while($clientrow = mysql_fetch_array($selectcrres))       {         $clientdetail[$k]['javkdate'] = $clientrow['javkdate'];                          $clientdetail[$k]['javkfine'] = $clientrow['javkfine'];                          $clientdetail[$k]['javakamt'] = $clientrow['javakamt'];                         }         $selectcr = "select rojmeldate avakdate,fine avakfine,amount avakamt                          rojmel                    rojtranstype = 'a'                   , partyid = ".$partyid;       $selectcrres = mysql_query($selectcr);       while($clientrow = mysql_fetch_array($selectcrres))       {         $clientdetail[$k]['avakdate'] = $clientrow['avakdate'];                          $clientdetail[$k]['avakfine'] = $clientrow['avakfine'];                          $clientdetail[$k]['avakamt']  = $clientrow['avakamt'];                         }       $k++;     }       $z=0;     $clientarray = array();     $selectclient = "select partyid,partyname                        party                     partytype = 'c'";     $selectclientres = mysql_query($selectclient);     while($clientrow = mysql_fetch_array($selectclientres))     {       $clientarray['partyid'][$z]   = $clientrow['partyid'];       $clientarray['partyname'][$z] = $clientrow['partyname'];       $z++;     }      $selectamount = "select sum(kg) jkg,sum(totalamt) jtotalamt                        client                       clitranstype = 'j'                 , partyid = ".$partyid;     $selectamountres = mysql_query($selectamount);     if($jrow = mysql_fetch_assoc($selectamountres))     {       $jkg          = $jrow['jkg'];       $jtotalamt    = $jrow['jtotalamt'];      }      $selectaavkamount = "select sum(kg) akg,sum(totalamt) atotalamt                        client                       clitranstype = 'a'                 , partyid = ".$partyid;     $selectaavkamountres = mysql_query($selectaavkamount);     if($arow = mysql_fetch_assoc($selectaavkamountres))     {       $akg          = $arow['akg'];       $atotalamt    = $arow['atotalamt'];       }      $finalkg     = $akg - $jkg;     $finalamount = $atotalamt - $jtotalamt;       include("./bottom.php");     $smarty->assign("crarray",$crarray);     $smarty->assign("finalamount",$finalamount);     $smarty->assign("finalkg",$finalkg);     $smarty->assign("partyid",$partyid);     $smarty->assign("clientdetail",$clientdetail);     $smarty->assign("clientarray",$clientarray);     $smarty->display("clientlist.tpl"); } ?> 


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -