function getAlldetails($id, $lat, $lng)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `servicesubcatrelation` a,`ownerservice` b,`servicebranch` c WHERE a.sub_category_id={$id} and a.service_id=b.service_id and b.service_id=c.service_id ";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $data = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($res)) {
            if (distance($lat, $aRow['branch_lat'], $lng, $aRow['branch_lng']) < 300) {
                $data[] = $aRow;
            }
        }
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $data;
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
Example #2
0
function aGetUserbyPass($user, $pass)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `admin` where `email` = '{$user}' AND `password` = '{$pass}';";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
function insertintofreeservicedb($owner_id, $branch_id, $frees_name, $free_description, $counter, $created_at, $validity)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `freeservicedb` (`id`,`owner_id`, `branch_id`,`free_name` ,`free_description`,`counter`,`timestamp`,`validity`) VALUES (NULL, '{$owner_id}', '{$branch_id}','{$free_name}','{$free_description}','{$counter}', '{$created_at}','{$validity}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
function insertintosingleent($owner_id, $category_id, $ent_name, $ent_details, $ent_website, $isActive, $listingType, $ProvidesFreeSrvc, $premiumStartDate, $premiumEndDate, $amount_paid, $created_at)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `servicebranch` (`ent_id`,`owner_id`,`category_id`,`ent_name`,`ent_details`,`ent_website`,`isActive` ,`listingType` ,`ProvidesFreeSrvc` ,`premiumStartDate` ,`premiumEndDate`,`amt_paid`,`timeStamp`) VALUES (NULL, '{$owner_id}', '{$category_id}','{$ent_name} ','{$ent_details}','{$ent_website}','{$isActive}' ,'{$listingType}' ,'{$ProvidesFreeSrvc}' ,'{$premiumStartDate}' ,'{$premiumEndDate}','{$amount_paid} ','{$created_at}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $ent_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $ent_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
function insertintoservicesused($user_id, $service_id, $single_id, $freeserivce_id, $created_at)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `services_used` (`id`,`user_id`,`service_id`, `singleent_id`,`freeservice_id` `timeStamp`) VALUES (NULL, '{$user_id}','{$service_id}','{$single_id}','{$freeservice_id}' ,'{$created_at}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $user_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $user_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
function insertintoownerapp($owner_name, $owner_email, $service_mobile_num, $password, $created_at, $isActive, $type)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `ownerapp` (`owner_id`,`owner_name`, `owner_email`, `service_mobile_number`, `password`, `timeStamp`,`isActive`,`type`) VALUES (NULL, '{$owner_name}','{$owner_email}','{$service_mobile_num}','{$password}','{$created_at}','{$isActive}','{$type}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        $owner_id = mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $owner_id;
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
function insertintoservicesubcatrelation($service_id, $ent_id, $free_id, $subcategory_id)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `servicesubcatrelation` (`service_id`,`ent_id`,`free_id`,`sub_category_id`) VALUES ('{$service_id}','{$ent_id}','{$free_id}','{$subcategory_id}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
function insertintofriend($name, $data)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `friend_list` (`user_id`,`friend_name`) VALUES ('{$data}', '{$name}');";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        mysqli_insert_id($rConnection);
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
function getAllfriendservices($id)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `friend_list` a,`user` b,`services_used` c WHERE a.user_id={$id} and b.full_name=a.friend_name and c.user_id=b.user_id";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData[] = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
function aGetAllTags()
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT * FROM `interests` ORDER BY `id` DESC;";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData[] = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
function updatefreeservice_id($freeservice_id, $rating)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "UPDATE `freeservicedb` SET `avg_rating`='{$rating}' WHERE `id`='{$freeservice_id}'";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        //! Closing the connections
        dbConnectionClose($rConnection);
        return $rating_id;
        //! Message Login
        comment_message_log('Query Executed Successfully.::: owner_id = $owner_id ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}
function searchinservice($string)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "SELECT `service_id`,`service_name` FROM `ownerservice` WHERE `service_name` OR `service_details` LIKE '%{$string}%'";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        $aData = array();
        //! retrieve the result from the result set
        while ($aRow = mysqli_fetch_assoc($rResultSet)) {
            $aData[] = $aRow;
        }
        comment_message_log('End of Function : ' . __FUNCTION__);
        return $aData;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
function addintofriendlist($user_id, $friend)
{
    //! Message Loggin
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "INSERT INTO `friend_list` (`user_id`,`friend_name`) VALUES ('{$user_id}','{$friend_name}');";
    //! Executing the query
    $rResultSet = mysqli_query($rConnection, $sQuery);
    //! Closing the connections
    dbConnectionClose($rConnection);
    /*!
     *  Check If the Query executed properly
     */
    if ($rResultSet != '') {
        //! Message Login
        comment_message_log('Query Executed Successfully. ::: ' . $sQuery);
        //! retrieve the result from the result set
        comment_message_log('End of Function : ' . __FUNCTION__);
        return 1;
    } else {
        //! Message Loggin
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00100;
    }
}
function iUpdatesubCats($sub_category_id, $category_id, $subcategoryname, $showinapp)
{
    comment_message_log('Start of Function : ' . __FUNCTION__);
    //! Data base connection
    $rConnection = dbConnection();
    /*!
     * Check if the database Connection is failed
     */
    if (!$rConnection) {
        //! Message Loggin
        comment_message_log('End of Function : ' . __FUNCTION__);
        return E00010;
    }
    //! Query
    $sQuery = "UPDATE sub_category SET `category_id` = '{$category_id}' , `sub_category_name` = '{$subcategoryname}',`show_in_app` = '{$showinapp}' WHERE `sub_category_id` = '{$sub_category_id}' ";
    //! Executing the query
    $res = mysqli_query($rConnection, $sQuery);
    /*!
     * Check If the Query executed properly
     */
    if ($res) {
        //! Closing the connections
        dbConnectionClose($rConnection);
        //! Message Login
        comment_message_log('Query Executed Successfully.::: id = $iId ::: ' . $sQuery);
        comment_message_log('End of Function : ' . __FUNCTION__);
    } else {
        comment_message_log('Query Execution failed. ::: ' . $sQuery . ' ::: ' . @mysqli_error($rConnection));
        comment_message_log('End of Function : ' . __FUNCTION__);
        //! Closing the connections
        dbConnectionClose($rConnection);
        return E00100;
    }
}