prepare("SELECT COUNT(*) FROM comments WHERE leadid = :leadid"); $stmt->bindParam(':leadid', $_GET['id']); $stmt->execute(); $totalRecords = $stmt->fetchColumn(); // echo $totalRecords; if($_SERVER['REQUEST_METHOD']=="POST" && isset($_POST['update_data']) && $_POST['update_data']){ try { $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("UPDATE cleads SET name = :name, email = :email, phone = :phone, date = :date, status = :status, user = :user, country = :country, state= :state, city = :city, address = :address, profession = :profession, coupon_code = :coupon_code, gender = :gender, warm_status = :warm_status WHERE id = :id"); $stmt->bindParam(':name', $_POST['name']); $stmt->bindParam(':email', $_POST['email']); $stmt->bindParam(':phone', $_POST['phone']); $stmt->bindParam(':date', $_POST['date']); $stmt->bindParam(':status', $_POST['status']); $stmt->bindParam(':user', $_POST['user']); $stmt->bindParam(':country', $_POST['country']); $stmt->bindParam(':state', $_POST['state']); $stmt->bindParam(':city', $_POST['city']); $stmt->bindParam(':address', $_POST['address']); $stmt->bindParam(':profession', $_POST['profession']); $stmt->bindParam(':coupon_code', $_POST['coupon_code']); $stmt->bindParam(':gender', $_POST['gender']); $stmt->bindParam(':warm_status', $_POST['warm_status']); $stmt->bindParam(':id', $_GET['id']); $stmt->execute(); echo "Record Updated successfully"; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } }; try { // $password = md5($_POST['pass']); // $email = $_POST['email']; $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT * FROM cleads WHERE id = :id"); $stmt->bindParam(':id', $_GET['id']); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); // var_dump($rows); foreach($rows as $row){ $nameParts = explode(" ", $row['name']); $firstInitial = substr($nameParts[0], 0, 1); $lastInitial = substr($nameParts[count($nameParts) - 1], 0, 1); $name_letter = $firstInitial.$lastInitial; if($row['status'] == 'New'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';} elseif($row['status'] == 'Contacted'){$conditional_background_color = 'background-color: #D4FFFF; border: 1px solid #2C9C9C; border-radius: 5px; color: #2C9C9C;';} elseif($row['status'] == 'Disqualified'){$conditional_background_color = 'background-color: #CECECE; border: 1px solid #3F4254; border-radius: 5px; color: #3F4254;';} elseif($row['status'] == 'Converted'){$conditional_background_color = 'background-color: #D4FDE7; border: 1px solid #40916C; border-radius: 5px; color: #40916C;';} elseif($row['status'] == 'Warm'){$conditional_background_color = 'background-color: #FFD9D9; border: 1px solid #FB5555; border-radius: 5px; color: #FB5555;';} ?>

Client ID

Form Name

Country

State

City

Address

Profession

Origin

Lead Status

'; $options = array("Proposal Sent", "Meeting Conducted", "Interested"); foreach ($options as $option) { $selected = ($option == $row['warm_status']) ? 'selected' : ''; echo ''; } echo ''; } ?>

Coupon Code

Time

Follow Update

Comments:

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("INSERT INTO comments (comments, user, locale, leadid) VALUES (:comments, :user, :locale, :leadid)"); $stmt->bindParam(':comments', $_POST['comments']); $stmt->bindParam(':user', $_SESSION['email']); $stmt->bindParam(':locale', $local_lang); $stmt->bindParam(':leadid', $_GET['id']); $stmt->execute(); echo "New Comment save successfully"; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } }; ?>
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT * FROM comments WHERE leadid = :leadid ORDER BY created_at DESC"); $stmt->bindParam(':leadid', $_GET['id']); $stmt->execute(); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach($rows as $row){ $commenter_name_parts = explode("@", $row['user']); $commenter_first_name_letter = substr($commenter_name_parts[0], 0, 1); $commenter_last_name_letter = substr($commenter_name_parts[count($commenter_name_parts) - 1], 0, 1); ?>


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

"; }; $saved_message = ""; if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['appt_comment']) && $_POST['appt_comment'] && isset($_POST['appt_date']) && $_POST['appt_date'] ){ try { $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("INSERT INTO appointment (appt_date, email, name, leadid, comment) VALUES (:appt_date, :email, :name, :leadid, :comment)"); $stmt->bindParam(':appt_date', $_POST['appt_date']); $stmt->bindParam(':email', $_SESSION['email']); $stmt->bindParam(':name', $_SESSION['name']); $stmt->bindParam(':leadid', $_GET['id']); $stmt->bindParam(':comment', $_POST['comment']); $stmt->execute(); $saved_message = "New Appointment save successfully"; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } }; if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['appt_comment_update']) && $_POST['appt_comment_update'] && isset($_POST['appt_date']) && $_POST['appt_date'] ){ try { $conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("UPDATE appointment SET appt_date = :appt_date, comment = :comment WHERE id = :appointment_id AND leadid = :leadid"); $stmt->bindParam(':appt_date', $_POST['appt_date']); $stmt->bindParam(':comment', $_POST['comment']); $stmt->bindParam(':leadid', $_GET['id']); $stmt->bindParam(':appointment_id', $_POST['appointment_id']); $stmt->execute(); $saved_message = "Appointment updated successfully"; } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } }; ?>

Add Appointment

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT * FROM appointment WHERE leadid = :leadid"); $stmt->bindParam(':leadid', $_GET['id']); $stmt->execute(); $appt_data = $stmt->fetchAll(PDO::FETCH_ASSOC); // Custom function to compare appointment dates function compareAppointmentDates($a, $b) { $dateA = new DateTime($a['appt_date']); $dateB = new DateTime($b['appt_date']); $currentDateTime = new DateTime(); // Compare appointment dates if ($dateA == $dateB) { return 0; } // Check if appointments are in the future or past if ($dateA > $currentDateTime && $dateB > $currentDateTime) { return ($dateA < $dateB) ? -1 : 1; // Sort by ascending date } elseif ($dateA < $currentDateTime && $dateB < $currentDateTime) { return ($dateA < $dateB) ? 1 : -1; // Sort by descending date } else { // One appointment is in the future and one is in the past return ($dateA > $dateB) ? -1 : 1; // Sort the future appointment first } } // Sort appointments based on appointment date usort($appt_data, 'compareAppointmentDates'); foreach($appt_data as $appt){ $apptID = $appt['id']; // echo $appt['name']; $apptDate = explode(" ", $appt['appt_date']); $currentDateTime = new DateTime(); $appointmentDateTime = new DateTime($appt['appt_date']); if ($appointmentDateTime > $currentDateTime) { $app_status = 'Next Appointment'; } elseif ($appointmentDateTime < $currentDateTime) { $app_status = 'Expired Appointment'; } else { $app_status = 'Today\'s Appointment'; } ?>

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

"; }; ?>
Error: " . $e->getMessage() . "

"; }; ?>