<?php
ob_start();

date_default_timezone_set('Asia/Calcutta');
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);

// Database connection
$host = "localhost";
$user = "root";
$pwd = "";
$dbName = "novaivf_ewskalynngr";

global $conn;
mysqli_report(MYSQLI_REPORT_OFF);
$conn = mysqli_connect($host, $user, $pwd, $dbName);
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

if (!defined('MYSQL_ASSOC')) {
    define('MYSQL_ASSOC', MYSQLI_ASSOC);
}

if (!defined('MYSQL_NUM')) {
    define('MYSQL_NUM', MYSQLI_NUM);
}

if (!defined('MYSQL_BOTH')) {
    define('MYSQL_BOTH', MYSQLI_BOTH);
}

if (!function_exists('mysql_query')) {
    function mysql_query($query, $link_identifier = null)
    {
        global $conn;
        $link = $link_identifier ?: $conn;

        return mysqli_query($link, $query);
    }
}

if (!function_exists('mysql_num_rows')) {
    function mysql_num_rows($result)
    {
        if ($result instanceof mysqli_result) {
            return mysqli_num_rows($result);
        }

        return 0;
    }
}

if (!function_exists('mysql_fetch_assoc')) {
    function mysql_fetch_assoc($result)
    {
        if ($result instanceof mysqli_result) {
            return mysqli_fetch_assoc($result);
        }

        return false;
    }
}

if (!function_exists('mysql_fetch_array')) {
    function mysql_fetch_array($result, $result_type = MYSQL_BOTH)
    {
        if ($result instanceof mysqli_result) {
            return mysqli_fetch_array($result, $result_type);
        }

        return false;
    }
}

if (!function_exists('mysql_fetch_row')) {
    function mysql_fetch_row($result)
    {
        if ($result instanceof mysqli_result) {
            return mysqli_fetch_row($result);
        }

        return false;
    }
}

if (!function_exists('mysql_insert_id')) {
    function mysql_insert_id($link_identifier = null)
    {
        global $conn;
        $link = $link_identifier ?: $conn;

        return mysqli_insert_id($link);
    }
}

if (!function_exists('mysql_affected_rows')) {
    function mysql_affected_rows($link_identifier = null)
    {
        global $conn;
        $link = $link_identifier ?: $conn;

        return mysqli_affected_rows($link);
    }
}

if (!function_exists('mysql_real_escape_string')) {
    function mysql_real_escape_string($string, $link_identifier = null)
    {
        global $conn;
        $link = $link_identifier ?: $conn;

        return mysqli_real_escape_string($link, $string);
    }
}

if (!function_exists('mysql_error')) {
    function mysql_error($link_identifier = null)
    {
        global $conn;
        $link = $link_identifier ?: $conn;

        return mysqli_error($link);
    }
}

?>
