diff --git a/.hta_slug/leads.php b/.hta_slug/leads.php index a81ec39..55b687e 100644 --- a/.hta_slug/leads.php +++ b/.hta_slug/leads.php @@ -444,6 +444,33 @@ echo'
+ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $stmt = $conn->prepare("SELECT * FROM comments WHERE leadid = :leadid ORDER BY created_at DESC"); + $stmt->bindParam(':leadid', $singleLead['id']); + $stmt->execute(); + $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); + $comments = []; + foreach ($rows as $row) { + $comments[] = $row['comments']; + } + $singleLead['comments'] = $comments; + + $leadsWithComments[] = $singleLead; + + } catch (PDOException $e) { + echo "

Error: " . $e->getMessage() . "

"; + } + } + + // Now $leadsWithComments contains all leads with their respective comments + + ?>