php - set value from two select query in one array -
my 2 select query want fetch records in single array how possible set values in 1 array different select query
$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']; } $rojmelarray = array(); $l = 0; $selectrojmel = "select date_format(rojmeldate,'%d-%m-%y') rojmeldate,fine rojmelfine,amount rojmelamt,rojtranstype rojmel partyid = ".$partyid; $selectrojmelres = mysql_query($selectrojmel); while($rojmelrow = mysql_fetch_array($selectrojmelres)) { $rojmelarray[$l]['rojmeldate'] = $rojmelrow['rojmeldate']; $rojmelarray[$l]['rojmelfine'] = $rojmelrow['rojmelfine']; $rojmelarray[$l]['rojmelamt'] = $rojmelrow['rojmelamt']; $rojmelarray[$l]['rojtranstype'] = $rojmelrow['rojtranstype']; $l++; }
for first query section
{section name="sec" loop=$clientdetail} <td><a href="client.php?clientid={$clientdetail[sec].clientid}"><img src="img/edit.png"></a></td> <td>{$clientdetail[sec].particular}</td> <td>{$clientdetail[sec].cdate}</td> <td>{$clientdetail[sec].rate}</td> <td>{$clientdetail[sec].total}</td> <td>{$clientdetail[sec].kg}</td> <td>{$clientdetail[sec].totalamt}</td> </tr> {/section}
second query section
{section name="sec1" loop=$rojmelarray} {if $rojmelarray[sec1].rojtranstype == 'j' } <td>javak</td> {else} <td>aavak</td> {/if} <td>{$rojmelarray[sec1].rojmeldate}</td> <td>{$rojmelarray[sec1].rojmelfine}</td> <td>{$rojmelarray[sec1].rojmelamt}</td>
i result query
select client.*, date_format(rojmeldate,'%d-%m-%y') rojmeldate, fine rojmelfine, amount rojmelamt, rojtranstype client left outer join rojmel on rojmel.partyid = clientid client.`partyid`= ".$partyid;
Comments
Post a Comment