I am trying to get results from a database to appear and say "You're device is still under warranty." or "This device's warranty has expired." depending on if the warranty expiration date is older than todays date.
I am using a custom Wordpress page template to connect to a remote database. Here's what I have so far. I am connected to the database and can return results. I am just struggling with creating a search form that echoes the results in a way that is useful.
<?php $con = mysqli_connect("localhost","my_user","my_password","my_db");
// check connection
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
echo "Connected successfully";
?>
<form action="" method="post">
Search: <input type="text" name="term" /><br />
<input type="submit" value="Submit" />
</form>
<?php
if (!empty($_REQUEST['term'])) {
$term = mysql_real_escape_string($_REQUEST['term']);
$sql = "SELECT * FROM warranty WHERE serial LIKE '%".$term."%'";
$r_query = mysql_query($sql);
What I want to do here is say IF the serial number entered "warexp" has a date value older than today echo "This product's warranty is expired." and if it returns a date that has not yet passed echo as my ELSE statement "Your device is still under warranty.". I am really confused about this part and how to get it to work on a custom page template in Wordpress or if that even matters.
while ($row = mysql_fetch_array($r_query)){
?????????????????????????
?>
Thank you in advance for any insight. I hope my description of the problem is clear.