Welcome Guest, Not a member yet? Register   Sign In
Few questions about MVC stuff
#1

[eluser]jhyland[/eluser]
So im just learning both OOP and MVC as well. However, CI makes it very easy to take on OOP, Smile

Im working on a rough draft of a new application, and im running into a few logic errors relating to MVC...

1) I get that data related stuff goes into the Model, and the logic goes into the Controller, and any HTML output related code goes into the View, but where do I put the code that validates/sanitizes and runs logic to user input for the SQL query within the model? Does that go inside the model? If a step in my input validation/logic fails, how does that get handed from the model to the view?

2) Heres an example of a good chunk of PHP that im using, its just a switch statement, but right now, its in a view. A different view will grab the sql data from a model, then for each row thats returned, it includes the view that has all of this PHP (So its a nested view). My question is... is this too much PHP for a view? If so, how do I fit it into the controller? http://pastebin.com/5Dj4Z7ze

3) Ive looked around, and I see a lot of tutorials about how to write insert statements for mysql, but say for example.. I want to test if the update failed. How do I execute it in the model, then hand the return code back to the view for checking? (Or should it be the controller that checks?...)

I think thats all the questions I have right now, ill update if I have more.


Messages In This Thread
Few questions about MVC stuff - by El Forum - 08-04-2012, 08:42 AM
Few questions about MVC stuff - by El Forum - 08-04-2012, 02:49 PM
Few questions about MVC stuff - by El Forum - 08-04-2012, 04:25 PM
Few questions about MVC stuff - by El Forum - 08-04-2012, 09:07 PM
Few questions about MVC stuff - by El Forum - 08-04-2012, 11:08 PM
Few questions about MVC stuff - by El Forum - 08-05-2012, 03:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB