<?php
include('dbconnect.php');
include('function.php');
// Query to fetch data
$sql = "SELECT id, name, email, mobile_no, role, DATE_FORMAT(cdate, '%k:%i %p, %d %b %y') as created_date,flag,action,status,password,lead_flag FROM tbl_invite_user";
$result = $conn->query($sql);

$data = [];
if ($result->num_rows > 0) {
    // Fetch the data and store it in an array
	$sl=1;
    while ($row = $result->fetch_assoc()) {
        $project_name=get_user_project_name($row['id']);
        $data[] = [$sl, $row['name'], $row['email'], $row['mobile_no'], $row['role'], $row['created_date'],$project_name,$row['password'],$row['status'],$row['lead_flag'],$row['id']];
		$sl++;
    }
}

// Close the database connection
$conn->close();

// Return the data as JSON
echo json_encode($data);



?>
