Welcome Guest, Not a member yet? Register   Sign In
Simple query not working
#5

[eluser]mabright[/eluser]
Tried and failed. As I said, this is weird, it should be working just fine. Below is the all the code from my model and the call from the controller. Maybe I'm missing something.

Code:
class Venue_model extends Model {
    
    function Venue_model()
    {
        parent::Model();
    }
    
    public function get_region($country,$state)
    {
        $country = strtoupper(trim($country));
        $state   = strtoupper(trim($state));
        
        $sql = "SELECT `region` FROM `my_region_table`
                       WHERE UPPER(`country`) = ?
                       AND   UPPER(`description`) = ?";

        $query = $this->db->query($sql,array($country,$state));
        if ($query->num_rows() > 0)
        {
            foreach ($query->result() as $row)
           {
               return $row->region;
           }
        }
    }
    
}

Code:
public function get_user_location()
    {                
        $location  = file_get_contents('http://ipinfodb.com/ip_query.php?ip='.$this->input->ip_address().'&timezone=false', 'r');
        $loc_array = explode(' ',$location);
        $region = $this->Venue_model->get_region(trim($loc_array[8]),trim($loc_array[15]));
        $addr_str = trim($loc_array[17]).', '.$region;
        return $addr_str;        
    }


Messages In This Thread
Simple query not working - by El Forum - 08-16-2010, 08:24 PM
Simple query not working - by El Forum - 08-16-2010, 09:51 PM
Simple query not working - by El Forum - 08-17-2010, 06:10 AM
Simple query not working - by El Forum - 08-17-2010, 08:30 AM
Simple query not working - by El Forum - 08-17-2010, 08:52 AM
Simple query not working - by El Forum - 08-17-2010, 09:22 AM
Simple query not working - by El Forum - 08-17-2010, 09:31 AM
Simple query not working - by El Forum - 08-17-2010, 03:07 PM
Simple query not working - by El Forum - 08-18-2010, 02:01 AM
Simple query not working - by El Forum - 12-06-2010, 04:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB