init
This commit is contained in:
68
.hta_slug/cleads/_home copy 2.php
Normal file
68
.hta_slug/cleads/_home copy 2.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
require_once('/var/www/html/.hta_config/crm_config.php');
|
||||
require_once('/var/www/html/.htac_header.php');
|
||||
require_once('/var/www/html/.htac_nav.php');
|
||||
// echo $_SESSION['access'];
|
||||
?>
|
||||
<?php
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM business_verticals");
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (count($rows) >= 1) {
|
||||
foreach($rows as $row){
|
||||
echo ' <div style="display: flex; flex-direction: row;">
|
||||
<a href="/cleads/by-business-verticals/?bv='.$row['bv'].'">'.$row['bv'].'</a>
|
||||
</div>';
|
||||
}
|
||||
} else {
|
||||
echo "<p class='text-danger'>Not Found any Data</p>";
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$accessArray = explode(",", $_SESSION['access']);
|
||||
$placeholders = rtrim(str_repeat('?,', count($accessArray)), ','); // Creating placeholders like ?,?,?,?
|
||||
$stmt = $conn->prepare("SELECT * FROM cleads WHERE business_type IN ($placeholders) LIMIT 10");
|
||||
foreach ($accessArray as $key => $value) {
|
||||
$stmt->bindValue($key + 1, $value);
|
||||
}
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
echo '
|
||||
<div id="example-table"></div>
|
||||
|
||||
<link href="https://unpkg.com/tabulator-tables@6.2.0/dist/css/tabulator.min.css" rel="stylesheet">
|
||||
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@6.2.0/dist/js/tabulator.min.js"></script>
|
||||
<script>
|
||||
//define data
|
||||
var tabledata = '.json_encode($rows).';
|
||||
|
||||
//define table
|
||||
var table = new Tabulator("#example-table", {
|
||||
data:tabledata,
|
||||
autoColumns:true,
|
||||
});
|
||||
</script>
|
||||
';
|
||||
$num_rows = $stmt->rowCount();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Reference in New Issue
Block a user