Welcome Guest, Not a member yet? Register   Sign In
Session variable needs to change all DB queries.. any ideas ?
#6

[eluser]mr_madness[/eluser]
man, thanks soo much for your will to help out, even with all this code posted... I think on a late time like when you posted it's not easy to read all that and figure out all my logic from scratch hehe Smile

Now man, no, you didn't missed the point, you got it pretty good ... the system flow you described is correct and that is what i have ready here.
Now that you understand better what i have i can ask my question clearer. What I wanted to know is how could I add the "city" condition to my SQL statements, without having to do it controller by controller, in every function that i call the companies, which are all related to the other tables?

I wished to do that one time only, would even make conditions in the model if needed to check if we're accessing companies table and then add the city WHERE statement to those queries so if i happened to change that, I would only change one line, not having to go thru all the controllers to do so.

on the "breaking down the model" part, yeah, I understand that and I think i'm probably doing a bad practice on mine, but I tried before using something quite like that, but when I had many tables and various situations to get data from them, ended up with 'n' get functions, with 'n' parameters each and that became quite a mess too haha ! Tongue

The reason i did it like that is cause I like things the most generic they can be. If one function can serve another 2, 3 or 4, that's fine for me. This helps not having to copy/paste similar code just cause , let's say, page 1 needs one thing and page 2 needs the same thing but using another table. Instead of pasting the same code in the other get function, better use one who does the same thing for both while allowing you to change the table you want to get the data from. At least for me, it works to help staying organized

BTW i'm still open for more suggestions, I figured a way through that problem, but it's not quite like i wanted, changed it controller by controller from what was ready here.

@boltsabre thank you very much for your time, patience and your suggestions, I'll think about a way of using some of em surely. Smile


Messages In This Thread
Session variable needs to change all DB queries.. any ideas ? - by El Forum - 07-15-2011, 07:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB