Problem w/datediff


Thread Starter
Nov 16, 2014
Hi guys, please advise me as to what I'm doing wrong. My test database table fields have
"payrec" has 'p', "amtdue" is blank, recur has 'N' and "duedate" is past.
the code:

@Page { size 8.5in 11in; margin: 2cm } { page-break-after: always }
<div class="page">

//Open a new connection to the MySQL server
require_once "getacctdb.php";

//MySqli Select Query
$results = $mysqli->query (SELECT acctno, recur, pd, payrec, bname, datepaid, amtdue,
DATEDIFF(CURDATE(),duedate) AS dayslate, FROM accttbl` WHERE payrec = 'p' AND amtdue != '' AND
recur = 'N'";

echo date('m/d/y');
<font size=+1><b><center> Accounts Payable Report</font></center></b></b><br />
<table cellspacing=0 cellpadding=0 border=1>
<th bgcolor="#ccffff">acct#</th>
<th bgcolor="#ccffff">creditor</th>
<th bgcolor="#ccffff">due date</th>
<th bgcolor="#ccffff">days late</th>
<th bgcolor="#ccffff">amt due</th>
while($row = mysql_fetch_array($result))
$totdue += $row['amtdue'];
echo '
<td>', $row['acctno'], '</td>
<td>', $row['bname'], '</td>
<td>', $row['duedate'], '</td>
<td>', $row['dayslate'], '</td>
<td align=right class="currency">$'.number_format($row['amtdue'],2).'</td>
echo '
<th bgcolor="#ccffff" scope="row" colspan="7">Grand Total:</th>
<td bgcolor="#FFD4D4" class="currency">$'.number_format($totdue, 2, '.', ''), '</td>

echo "Page 1";
<div class="page">
echo "Page 2";

the result:
query ("SELECT acctno, recur, pd, payrec, bname, DATEDIFF(CURDATE(),duedate) AS dayslate, datepaid, amtdue FROM accttbl` WHERE payrec = 'p' AND amtdue != '' AND recur = 'N'"); echo date('m/d/y'); ?>
Accounts Payable Report

'; } echo '
acct# creditor due date days late amt due
', $row['acctno'], ' ', $row['bname'], ' ', $row['duedate'], ' ', $row['dayslate'], ' $'.number_format($row['amtdue'],2).'
Grand Total: $'.number_format($totdue, 2, '.', ''), '
'; echo "Page 1";
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online