I did a search through to see if I could find my answer, but it's entirely i'm not using the correct terminology so feel free to smack me on the back of the head and link me to the correct page if I missed it :)
What I am doing is searching a table for a specific item, in this case a MAC address. if it's not found, I want to echo "not found";
If it is found, I want to check another row for the date of that MAC. if the date is older than specified, then echo "recall";
If the MAC is newer than the date, echo "MAC okay";
Here is a sample of what the able looks like:
| mac | date |
| 00-00-00-00-00-00 | 2014/10/17 |
My form is written well, it's giving the correct info to the PHP, but here it is anyway:
<form action="results.php">
mac id
<input type="text" name="mac">
<input type="submit">
</form>
and here is the PHP from results.php. It's connecting the table no issue. I think the core of the issue is my query:
<?PHP
$mac= $_POST[‘mac’];
include "connect.php";
$query = mysql_query(“SELECT mac,date FROM units WHERE mac='$mac'");
$results = $query->getResults();
if( sizeof($results) > 0 ){
// look up the documentation for date_diff, DateTime, and DateInterval.
$interval = date_diff( $results[0]->date_built, new DateTime('2014/10/19') );
if( $interval->invert = 1 ){ // i think this is how to test for before/after, but double-check me.
echo "recall";
}
else {
echo "unit okay";
}
}
else {
echo "not found";
}
?>