php pagebreaks

Hi, Someone please tell me how to resolve this issue ? following is error derived from
my code which then follows:

Notice: Undefined variable: rows in C:\xampp\htdocs\invoice\apdueprnt.php on line 62
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\invoice\apdueprnt.php on line 62

[php]

<meta
    http-equiv="Content-Type"
    content="text/html; charset=utf-8"
/>
 
<meta
    http-equiv="Content-Language"
    content="en"
/>
 
<meta
    name="viewport"
    content="width=device-width; height=device-height; initial-scale=1.0"
/>
 
<link
    type="text/css"
    rel="stylesheet"
    href="print.css"
    media="print"
/>
 
<title>
    Accounts Payable Demo
</title>
 
</head><body>
 
<table class="accountsPayable">
    <caption>
        Accounts Payable Report
    </caption><thead>
        <tr>
            <th>recur?</th>
            <th>acct#</th>
            <th>creditor</th>
            <th>purpose</th>
            <th>due</th>
            <th>late</th>
            <th>due</th>
        </tr>
    </thead><tfoot>
        <tr>
            <td colspan="3">', date('m/d/y'), '</td>
            <td colspan="4" class="page"></td>
        </tr>
    </tfoot><tbody>
   
<?php
   
$totalDue = 0;
   
foreach ($rows as $row) {
    $totalDue += $row['amtdue'];
    echo '
        <tr>
            <td>', $row['status'], '</td>
            <td>', $row['acctno'], '</td>
            <td>', $row['bname'], '</td>
            <td>', $row['purpose'], '</td>
            <td>', $row['duedate'], '</td>  
            <td class="currency">', ($row['dayslate'] > 120 ? 'pastdue' : $row['dayslate']), '</td>
            <td class="currency">', number_format($row['amtdue'], 2, '.', ''), '</td>
        </tr>';
}
 
echo '
        <tr class="grandTotal">
            <th scope="row" colspan="6">Grand Total:</th>
            <td class="currency">', number_format($totalDue, 2, '.', ''), '</td>
        </tr>';
?>
 
    </tbody>
</table>
 
</body></html> [/php]

the error is pointing at this line:
[php]foreach ($rows as $row) {[/php]
and it’s telling you $rows is undefined.

I’m assuming $rows represents mysql data however, i can’t see it in your scripts and neither can php, hence the error.

Hope that helps,
Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service