<?php
$listname = $_POST['listname'];
$frmmode = $_POST['frm_mode'];
$errorMessage = "";
$conn = mysqli_connect("localhost","saqrxlbf_root","magnobytes@9090","saqrxlbf_kapaleshwar");
if (!$conn) {
	echo "Db not connected";
}
 if (!$conn->set_charset('utf8')) {
	//	printf("Error loading character set utf8: %s\n", $conn->error);
	//	exit;
	}
if (isset($frmmode))
{
    $sql= "SELECT * FROM `kapaleshwar` WHERE `type` = '" . $listname."'";
	$result = mysqli_query($conn, $sql);
	$totalData = mysqli_num_rows($result);
}
 
    if ($totalData > 0) {
        while ($DataVal = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
           // print_r($DataVal);
        $data[] = array('id'=>$DataVal['id'],'title'=>$DataVal['title'],'bhajan'=>$DataVal['bhajan']);
        }
   // header('Content-Type: application/json; charset=utf-8');
    echo json_encode($data);
    exit;
    }
?>