Here’s the deal I’m using a pretty basic php pdo CRUD framework that I’m customizing for my workplace to use as a tracker. What has been requested of me is to set it up so that for example 10 minutes has passed the cell color would change from green to red. The big problem I’m running into is that it would appear that a part of my code is either not able to fetch or query the database and pull the required info. Considering everything else within the coding works as expected. I’m pretty sure I’ve narrowed down my issue. I just don’t know what I’m doing wrong. I’m using views created within phpmyadmin to aid in helping me keep coding cleaner. So the calculation for the “waiting” column is being done within the view itself.
Here’s part of the code I’m working with:
include ‘config/database.php’;
$page = isset($_GET[‘page’]) ? $_GET[‘page’] : 1;
$records_per_page = 5;
$from_record_num = ($records_per_page * $page) - $records_per_page;
$query = “SELECT ptfin, ptname, ptdob, pore, notes, labstat, rtstat,radstat,waiting FROM dashboard_view WHERE (labstat != ‘’ AND labstat IS NOT NULL) OR (radstat != ‘’ AND radstat IS NOT NULL) OR (rtstat != ‘’ AND rtstat IS NOT NULL) ORDER BY waiting DESC LIMIT :from_record_num, :records_per_page”;
$stmt = $con->prepare($query);
$stmt->bindParam(":from_record_num", $from_record_num, PDO::PARAM_INT);
$stmt->bindParam(":records_per_page", $records_per_page, PDO::PARAM_INT);
$stmt->execute();
$num = $stmt->rowCount();
$curDate = time();
$mysqlTimestamp = $row[‘waiting’]; //This is the piece of code that is giving me issues.
$dif = strtotime($curdate) - strtotime($mysqlTimestamp);
if($num>0) {
if($dif < 10000) {
$tdStyle=‘background-color:green;’;
} else {
$tdStyle=‘background-color:red;’;
}
echo “