Jump to content

Display data in template file

- - - - -

  • Please log in to reply
No replies to this topic

#1
newphpcoder

newphpcoder

    Programming Professional

  • Members
  • PipPipPipPipPipPip
  • 479 posts
Hi

I have a queries to display data in my template file, and i encountered problem in onclick EMP_ID

here is my query:

<?php

include 'config.php';


$currentEmpID = $_SESSION['empID'];


 $sql = "SELECT  em.EMP_ID, s.EMP_NO, s.SSSLoan, s.SSSAmor FROM $PAYROLL.sssloan s, $ADODB_DB.employment em WHERE em.EMP_NO= s.EMP_NO AND em.EMP_ID = '$currentEmpID'";

$rsloan = $conn2->Execute($sql);

                                                    

$LOAN = trim($rsloan->fields['SSSLoan']);

$AMOR = trim($rsloan->fields['SSSAmor']);

 

$smarty->assign('LOAN', $LOAN);

$smarty->assign('AMOR', $AMOR);


$sql = "SELECT s.EMP_NO, p.EMP_ID, p.SSS, CONCAT(LNAME, ', ',  FNAME, ' ', MI, '.') AS FULLNAME, s.SSSLoan, s.SSSAmor, s.DATE_PROCESS FROM $ADODB_DB.PERSONAL p, $ADODB_DB.employment em, $PAYROLL.sssloan s WHERE s.EMP_NO = em.EMP_NO AND p.EMP_ID = '$currentEmpID' AND em.EMP_ID = '$currentEmpID'";


$rs = $conn2->GetAll($sql);


$smarty->assign('getsss', $rs); 

?>



and here is the template code:

// this data will change if the EMP_ID was click

<input type="text" name="LOAN" value="{$LOAN}" size="9"> 

<input type="text" name="AMOR" value="{$AMOR}" size="9">


{section name=att loop=$getsss} 

  <tr>

    <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].SSS}</td>

    <td colspan="4" style="background: #e2e2e2" readonly="readonly" onclick="changeEmployee1('{$getsss[att].EMP_ID}')">{$getsss[att].EMP_NO}</td>

    <!--<td colspan="4" style="background: #e2e2e2" readonly="readonly"><a href="SSSgetdata.php?queryEmpID={$getsss[att].EMP_ID}">{$getsss[att].EMP_NO}</td>  -->

    <td colspan="15" style="background: #e2e2e2" readonly="readonly">{$getsss[att].FULLNAME}</td>   

    <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].SSSLoan}</td>

    <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].SSSAmor}</td>

    <td colspan="4" style="background: #e2e2e2" readonly="readonly">{$getsss[att].DATE_PROCESS}</td>

   

    

  </tr>

{sectionelse}   

  <tr><td colspan="1">No DATA</td></tr>

{/section} 


My problem is in onclick,the data loan and amor was not change when i click EMP_ID.

Thank you




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users