Firstly, Heres my code,
echo 'Do note that 2012-01-01 is in week ' . date('W', strtotime('2012-01-01')) . ' of "weekyear" ' . date('o');$start_date = '2011-04-06';$check_date = strtotime($start_date);$end_date = '2012-04-05';
echo '<table border="1" bordercolor="" width="100%" bgcolor="">
<thead>
<tr>
<td>Start Date</td>
<td>Month</td>
<td>Week</td>
<td>Pay in the week or month including statutory payments (SSP/SMP/OSPP/ASPP/SAP)</td>
<td>Total pay to date</td>
<td>Total "free pay" to date as shown by table A</td>
<td>Total Additonal Pay to date as shown by table A</td>
<td>Total Taxable pay to date</td>
<td>Total Tax due</td>
<td>Total Tax due at end of current period</td>
<td>Regulatory limit</td>
<td>Tax deducted or refunded</td>
<td>Tax not deducted</td>
</tr>
</thead>
<tbody>';
$sqlp = mysql_query("SELECT * FROM Payslips WHERE payslip_Employer='". $_SESSION['UID'] . "' AND payslip_employee='" . $id . "' AND payslip_PayDay=' . strtotime('+7 day', $check_date) . '");
if(mysql_num_rows($sqlp) > 0)
{
while($a = mysql_fetch_array($sqlp))
{
$i = 0;while (date('Y-m-d', $check_date) <= $end_date && ++$i < 54){
$check_date = strtotime('+7 day', $check_date);
printf('
<tr>
<td>%s</td>
<td>%s</td>
<td>%d</td>
<td>' . $a['payslip_Gross'] . '</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr',
date('d-m-Y', strtotime('-7 day', $check_date)),
date('m', strtotime('-3 month', $check_date)),
date('W', strtotime('-14 week', $check_date)) );} }}
echo ' </tbody></table>';
What I want to do Is display $a['payslip_Gross'] in the 4th column and I want going in the right row, so it matches up with the correct week in column 1.
I think the problem is in my query, AND payslip_PayDay=' . strtotime('+7 day', $check_date) . ',
I need to match payslip_PayDay which is in format dd/mm/yyyy, to the correct weekly row.
I'm not too good at explaining things so let me know if you need more information.
Thanks in advance
Michael