<?php
error_reporting(0);
$port=3306;
$servername = "localhost";
$database = "gssnagpu_psydeshmukh"; 
$username = "gssnagpu_psydeshmukh";
$password = "qP9dbNqWne6Rq92l";
$sql = "mysql:host=$servername;dbname=$database;port=$port";
$dsn_Options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
// Create a new connection to the MySQL database using PDO, $conn is an object
try { 
  $conn = new PDO($sql, $username, $password, $dsn_Options);
  //echo "Connected successfully";
} catch (PDOException $error) {
  echo 'Connection error: ' . $error->getMessage();
}

$Proj_Title = "Dr.Jayant Deshmukh";
$SiteUrl = "";
date_default_timezone_set("Asia/Kolkata");

function getList($sql){
  global $conn;  
    $res2 = $conn->query($sql);
    while($row2 = $res2->fetch()){
        $row3[] = $row2;
    }
    return $row3;
}

function getRecord($sql){
  global $conn;  
    $res2 = $conn->query($sql);
  $row2 = $res2->fetch();
    return $row2;
}

function getRow($sql){
  global $conn;  
    $res2 = $conn->query($sql);
  $row2 = $res2->rowCount();
    return $row2;
}

function getMaxNo($tbl){
  global $conn;  
  $sql = "SELECT (case when max(srno) is null then 1 else max((srno)+1) end ) 
          as mxsrno FROM ".$tbl."";
  $res2 = $conn->query($sql);
  $row2 = $res2->fetch();
  $srno = $row2['mxsrno'];
    return $srno;
}

?>