Jump to content

Error .. Please help


june_c21

Recommended Posts

hi, i want to output the report that content (start_date,end_date,user.name, report.staff_no,details,amount,gl_code,acc_no)  into a table and then calculate total amount of user claim and output it in the last column. i try this but got error with my code and i don't know how to solve it. please help,thanks

 

 

$query = "SELECT start_date,end_date,user.name, report.staff_no,details,amount,gl_code,acc_no FROM user,report WHERE report.staff_no = user.staff_no";

$result = mysql_query($query, $dblink);

echo "<table border=3 align=center width=70%>";

echo "<tr><td width=12% align=center><span class=style5>Start Date </td></span>";

echo "<td width=12% align=center><span class=style5>End Date</td></span>";

echo "<td align=center><span class=style5>Name</td></span>";

echo "<td align=center><span class=style5>Staff No</td></span>";

echo "<td align=center><span class=style5>Details</td></span>";

echo "<td align=center><span class=style5>Amount</td></span>";

echo "<td align=center><span class=style5>GL code</td></span>";

echo "<td align=center colspan=3><span class=style5>Account No. </td></span>";

echo "<td align=center colspan=3><span class=style5>Total </td></span></tr>";

 

 

while($myrow = mysql_fetch_row($result))

{

     

    echo "<tr><td><span class=style2>" . $myrow[0] . "</span</td>";

    echo "<td><span class=style2>" . $myrow[1] . "</span</td>";

    echo "<td><span class=style2>" . $myrow[2] . "</td></span>";

    echo "<td><span class=style2>" . $myrow[3] . "</span></td>";

    echo "<td><span class=style2>" . $myrow[4] . "</span></td>";

    echo "<td><span class=style2>" . $myrow[5] . "</span></td>";

    echo "<td><span class=style2>" . $myrow[6] . "</span></td>";

echo "<td><span class=style2>" . $myrow[7] . "</span></td>";

}

{

 

$query1 = "SELECT staff_no, SUM(amount) FROM report GROUP BY staff_no ";

$result1 = mysql_query($query1, $dblink);

while($myrow1 = mysql_fetch_row($result1)) {

echo "<td>" .$myrow1[0]. "</td>";}

}

Link to comment
https://forums.phpfreaks.com/topic/75884-error-please-help/
Share on other sites

Example of the report i want

 

Staff No    Name      Amount      Total Amount

123              A          20                20

123              A          30                50

123              B          30                30

Link to comment
https://forums.phpfreaks.com/topic/75884-error-please-help/#findComment-384069
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.