Can I return lots of results from one model function? |
[eluser]Assim[/eluser]
I know how I can return one function from a model, and I know I can do the same if I want to return another thing, but to save queries, I want to return lots of things with one function. To be clear, let's say I want to get the title and page contents from the database. They both are in the same table, but with the model I know how to get them in two different functions, is there a way to get them in one model function and give them each a variable?
[eluser]imn.codeartist[/eluser]
just store everything into array and return the array
[eluser]überfuzz[/eluser]
Code: $array = array('first_value','second_value');
[eluser]überfuzz[/eluser]
By the way. When you've get a hang of how to return stuff have a look at the user_guide. It covers how to query and return arrays.
[eluser]Assim[/eluser]
I still don't know how to use the active record in the models. I know everything that is needed to be known about the models, but let's say I want to perform the following query: SELECT name, password, email FROM users WHERE id = '1'; How can I perform it? This is some of the code where I just wrote it: Code: function get_user() But I don't know how to do what I asked above.
[eluser]n0xie[/eluser]
Code: $sql = "SELECT name, password, email FROM mytable WHERE id = 1"; |
Welcome Guest, Not a member yet? Register Sign In |