prepare("SELECT punches.id as punchid, users.id as user, punchtypes.punchname as type, punches.time as time, punches.notes as notes, punches.modified as modified FROM punches INNER JOIN users ON punches.userid = users.id INNER JOIN punchtypes ON punches.punchtypeid = punchtypes.id WHERE users.id = $userid ORDER BY punches.id DESC LIMIT 1"); $result->execute(); $last = $result->fetchObject(); echo "You have been punched $last->type since $last->time."; // eventually i will get these in one query - for now this is separate to show all punches vs the last punch and status $result = $sql->prepare("SELECT punches.id as punchid, users.id as user, punchtypes.punchname as type, punches.time as time, punches.notes as notes, punches.modified as modified FROM punches INNER JOIN users ON punches.userid = users.id INNER JOIN punchtypes ON punches.punchtypeid = punchtypes.id WHERE users.id = $userid ORDER BY punches.id DESC"); $result->execute(); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $time = $row['time']; $type = $row['type']; $changed = $row['modified']; if ($changed == "1") {$chg="YES";} else {$chg="NO";} $notes = $row['notes']; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ''; echo '
TimeTypeChangedNotes
$time$type$chg$notes
'; // end logged-in content } //************************ CONTENT END ************************ // Load footer require_once($yaptc_inc . "footer.inc.php"); ?>