I have a db that stores CC expiration dates. I'm writing a report within another software to pull this information. It works great, but shows all users with their cc expiration dates.
Is there a way to only grab expiration dates that can be set as a variable. Such as you can set a variable or either 30, 60, 90 days?
Here's the query to grab all the info:
$creditSQL = "SELECT id, firstname, lastname, organization, ccmonth, ccyear FROM users ORDER BY ccyear";
The ccmonth and ccyear are actually separate fields.
What I did when I printed the output, I used:
<font color=red>$ccmonth-$ccyear</font>
Is there a way to accomplish this with how the db structure is setup? I'd also like to show an error saying "No records found for your search" or similar if no credit cards are to be expiring within the set varaible of 30,60,90, etc.
Thanks in advance.
Below is the biggest chunk of the report:
// Get list of all variables
$creditSQL = "SELECT id, firstname, lastname, organization, ccmonth, ccyear FROM users ORDER BY ccyear";
// Execute the query
$result = mysql_query($creditSQL, $connection) or die("ERROR REPORT: $creditSQL");
echo " <br><br><b><center>Credit Card Expiration Dates</center></b><br><br>
<table border=1 width=100% bordercolor=dfdfdf><tr>
<td align=center><b>User ID</b></td>
<td align=center><b>First Name</b></td><td align=center><b>Last Name</b></td>
<td align=center><b>Organization</b></td><td align=center><b><font color=red>Credit Card Month-Year</font></b></td>
<tr> ";
// Loop through results and add a link to the Support Staff
while (list($id, $firstname, $lastname, $organization, $ccmonth, $ccyear) = mysql_fetch_row($result))
{
echo " <tr><td align=center><a href=index.php?fuse=3&frmClientID=$id&action=0>$id</td><td align=center>$firstname</td><td align=center>$lastname</td><td align=center>$organization</a></td><td align=center><font color=red>$ccmonth-$ccyear</font></td></tr> ";
}
echo " </tr></table> ";
?>