c
This commit is contained in:
@@ -101,9 +101,10 @@
|
||||
$state = $_POST['state'];
|
||||
$city = $_POST['city'];
|
||||
$address = $_POST['address'];
|
||||
$business_type = $_POST['business_type'];
|
||||
$status = 'New';
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address)");
|
||||
$stmt = $conn->prepare("INSERT INTO cleads (name, email, phone, formname, note, origin, status, gender, profession, country, state, city, address, business_type ) VALUES (:name, :email, :phone, :formname, :note, :origin, :status, :gender, :profession, :country, :state, :city, :address, :business_type)");
|
||||
$stmt->bindParam(':name', $name);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':phone', $phone);
|
||||
@@ -117,6 +118,7 @@
|
||||
$stmt->bindParam(':state', $state);
|
||||
$stmt->bindParam(':city', $city);
|
||||
$stmt->bindParam(':address', $address);
|
||||
$stmt->bindParam(':business_type', $business_type);
|
||||
$stmt->execute();
|
||||
echo "Record added successfully";
|
||||
} catch(PDOException $e) {
|
||||
@@ -220,9 +222,13 @@
|
||||
try {
|
||||
$searchTerm =isset($_GET['search']) ? $_GET['search'] : "%";
|
||||
$businessVertical =isset($_GET['bv']) ? $_GET['bv'] : "%";
|
||||
$dateForFilter = date('Y-m-d');
|
||||
|
||||
// Add one day to the current date
|
||||
$new_date = date('Y-m-d', strtotime($dateForFilter . ' +1 day'));
|
||||
// echo $businessVertical;
|
||||
$start_date = isset($_GET['start_date']) ? $_GET['start_date'] : '2014-05-05';
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : date('Y-m-d');
|
||||
$end_date = isset($_GET['end_date']) ? $_GET['end_date'] : $new_date;
|
||||
$start_time = microtime(true);
|
||||
$resultsPerPage = 200;
|
||||
$page =isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
@@ -245,8 +251,8 @@
|
||||
|
||||
$sql = "SELECT * FROM cleads WHERE business_type LIKE :businessVertical AND (name LIKE :searchTerm OR phone LIKE :searchTerm OR id LIKE :searchTerm OR email LIKE :searchTerm ) AND time BETWEEN :start_date AND :end_date ORDER BY id DESC LIMIT :limit OFFSET :offset";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bindValue(':businessVertical', $businessVertical, PDO::PARAM_STR );
|
||||
$stmt->bindValue(':searchTerm', "%$searchTerm%"); // PDO::PARAM_STR is the default data type binding so is not needed
|
||||
$stmt->bindValue(':businessVertical', "%".$businessVertical."%");
|
||||
$stmt->bindValue(':searchTerm', "%$searchTerm%");
|
||||
$stmt->bindValue(':start_date', $start_date);
|
||||
$stmt->bindValue(':end_date', $end_date);
|
||||
$stmt->bindValue(':limit', $resultsPerPage, PDO::PARAM_INT);
|
||||
@@ -380,7 +386,7 @@ echo'<div class="flex flex-row justify-between">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="origin">Origin:</label>
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" type="text" name="origin" id="origin" >
|
||||
<select class="" style="border: 1px solid #363650; border-radius: 5px; padding: 6px;" name="origin" id="origin" >
|
||||
<option value="Facebook Ads">Facebook Ads</option>
|
||||
<option value="Google Ads">Google Ads</option>
|
||||
<option value="Linkedin Ads">Linkedin Ads</option>
|
||||
@@ -394,6 +400,34 @@ echo'<div class="flex flex-row justify-between">
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="business_type">Verticals:</label>
|
||||
<select id="business_type" name="business_type" style="border: 1px solid #D9D9D9; border-radius: 5px; padding: 6px; width: 100%;">
|
||||
<option value="0">-Select-</option>
|
||||
<?php
|
||||
try {
|
||||
// Database connection
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Prepare and execute query
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$businessRows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Assuming this array contains the selected business verticals
|
||||
$selectedBusinessVerticals = [$businessVerticals['bv']];
|
||||
|
||||
// Loop through the business verticals
|
||||
foreach($businessRows as $businessVerticals) {
|
||||
echo '<option value="'.$businessVerticals['bv'].'">'.$businessVerticals['bv'].'</option>';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<label for="note">Note:</label>
|
||||
|
||||
Reference in New Issue
Block a user