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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.