Welcome Guest, Not a member yet? Register   Sign In
[Solved]Model Problem
#1

[eluser]eric cumbee[/eluser]
im not sure what is going on, i am passing an array into my model and loop through it creating or_where statements. the problem i am running into is that if i pass in a value like "Statesboro" when the query is executed the sql statement is something like this

Code:
SELECT COUNT(*) AS `numrows`
FROM (`voters`)
WHERE `reg_city` = 'S'

and then this is my model function
Code:
function count_voter($city) {
        if($city) {
           foreach($city as $row)
           {
                 $this->db->or_where('reg_city',$row['reg_city']);
            }
        }
        $this->db->from('voters');
        $count = $this->db->count_all_results();
        return $count;
    }

i have traced the data flowing all the way back from my view to the controller, and then the data being passed to the model from the controller, so i know for sure that the data is making it through the view and the controller with out being concatenated.


Messages In This Thread
[Solved]Model Problem - by El Forum - 08-23-2009, 01:05 PM
[Solved]Model Problem - by El Forum - 08-23-2009, 02:05 PM
[Solved]Model Problem - by El Forum - 08-23-2009, 02:17 PM
[Solved]Model Problem - by El Forum - 08-23-2009, 02:19 PM
[Solved]Model Problem - by El Forum - 08-23-2009, 02:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB