Location: PHPKode > projects > MembersGear > membersgear/includes/location_class.php
<?php
    
 class location_class extends peardb_class
 {   
    function View($pQuery, $pValues=false, $types=true, $pStart=0, $pEnd=0)
    {
        /*
        global $mdb2;    
        $result;  
 
        $query      = 'SELECT * FROM tbluser1 t limit 10;';
        $resultset  = $mdb2->query($query);
        
        if(PEAR::isError($resultset)) 
        {
            die("Failed to issue query, error message : " . $resultset->getMessage());
        }
        
        while($row = $resultset->fetchRow(MDB2_FETCHMODE_ASSOC))
        {
            $result[] = $row;
        }
                                                                                                                 
        return  $result;   
        */
        //print_r($pParameters);
        
        return $this->BaseView($pQuery,$pValues,$types,$pStart,$pEnd);
        
    }
    
    function Update($pQuery, $pValues=false, $types=true)
    { 
       
        return $this->BaseUpdate($pQuery, $pValues, $types);
    
    }

    
    function Insert($pQuery, $pValues=false, $types=true)
    { 
    
        return $this->BaseInsert($pQuery, $pValues, $types);
    
    }
    
    function Delete($pQuery, $pValues=false, $types=true)
    { 
    
        return $this->BaseDelete($pQuery, $pValues, $types);
    
    }
    
    function getCountryStateNameById($pId)
    {
        $lsvalue=array();
        $lsvalue[]=$pId;
        $query="SELECT * from  ".TABLE_PREFIX."location where id=?";
        $result=$this->View($query,$lsvalue,null);
        if(is_array($result) && sizeof($result)>0)
        {
            $lsname=$result[0]['name'];
        }
        else
        {
          $lsname='';  
        }    
        return $lsname;   
        
    }
    
    function getCountryStateIDByName($pName,$pParentID=0)
    {
        $liLocationID = 0;
        $lsValues = array($pName,$pParentID);
        $query = 'SELECT id FROM '.TABLE_PREFIX.'location WHERE name = ? AND parentid = ?';
        $result = $this->View($query,$lsValues,null);
        
        if(is_array($result) && sizeof($result)>0)
        {
            $liLocationID = $result[0]['id'];
        }
        else
        {
            $liLocationID = null;  
        }
    
        return $liLocationID;
    }    
    
    
 }   
?>
Return current item: MembersGear