File manager - Edit - /home/autoph/public_html/api/aha/SALES_loadMyProspect.php
Back
<?php // MySQL connection parameters $servername = "localhost"; $username = "autoph_admindb"; $password = "~cxk)gU^ziaB"; $database = "autoph_ahg_crm"; // Create connection $conn = new mysqli($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $mykey = $_GET['keyID']; //echo "Arnel " . $mykey; if($mykey =="ReadDealerInfo6e59e008b5348b452b615a3033729daae383loadPrespeect"){ $userID = $_GET['userID']; //get HR user Record ID include '../../../cfg/connhr.php'; $getUserID = "SELECT * FROM `users` WHERE `asa_app_user_id`='$userID'"; $quser = mysqli_query($connhr,$getUserID); while($usr = mysqli_fetch_array($quser)){ $saID = $usr['id']; } // SQL query $sql = "SELECT * FROM aha_sales_prospect WHERE `asa_user_id`='$userID' AND `deleted`=0 ORDER BY datetime_updated DESC"; $result = $conn->query($sql); $currentDate = new DateTime(); if ($result->num_rows > 0) { // Array to hold the results $count = 0; $rows = array(); // Fetch data from each row and add it to the array while($row = $result->fetch_assoc()) { // Create DateTime object for a given date $lastUpdateDate = new DateTime($row['datetime_updated']); // Get the difference $interval = $currentDate->diff($lastUpdateDate); if($interval->days >1){ $withS = 's'; }else{ $withS = ''; } $intervalDates = $interval->days ." day".$withS; if($intervalDates > 5){ $myCSS = 'daysRed'; }else{ $myCSS = 'daysGreen'; } $count =$count + 1; $rows[] = [$row,"days"=>"$intervalDates","myCSS"=>"$myCSS",]; } // Output the result in JSON format header('Content-Type: application/json'); echo json_encode([$rows,"Count" => "$count"]); } } // Close connection $conn->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings