0

I need help to be able to credit tenants that are in my system after every 30 days of stay. Code in either PHP, AJAX, jQuery

3
Contributors
3
Replies
16
Views
3 Years
Discussion Span
Last Post by Hegneous
0

You need to set a timestamp of when to start and a then a cron job to check when 30 days have be reached.. When the cron job runs, it will update code to set the database update credit. You would most likly do this in php if you are posting in php section of this forum.

0

Thanks Guyz... Atleast am some where with the following code:

<?php

include '../connection.php';

    $today = new DateTime('2014-7-14 20:10:10');
    $appt  = new DateTime('2014-8-15 20:10:10');
    $days_until_appt = $appt->diff($today)->days;


if ($days_until_appt>=30)
{

    $sql = "SELECT username FROM users WHERE position = 'Tenant'";
    $result = mysql_query($sql) or die(mysql_error());

    echo '<table align="center" border="1" cellpadding="0">';
    echo '<tr align="center"><th> Payee'.'</th><th> Credit'.'</tr>';

    while($row = mysql_fetch_array($result))
    {
    echo '<tr><th>'.$row['username'].'</th>'.'<br/>';
    $rw = $row['username'];

    $sq = "SELECT * FROM finance WHERE payee = '$rw'";
    $res = mysql_query($sq) or die(mysql_error());
    $rw = mysql_fetch_array($res);

    $total = $rw['credit']+ 3000;
    echo '<th>'.$rw['credit'].'</th></tr>'.'<br/>';
    }
    echo'</table>';
}
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.