Welcome Guest, Not a member yet? Register   Sign In
Newbie Q - controller/view code for mixed query
#22

[eluser]jmadsen[/eluser]
I've heard this before, but that doesn't make much sense to me - "minimize the code". Go count characters it takes to write my query vs. AR -- be sure to include "$this->db->select". It's not less code. Same with "pre-compiling" - just break up the strings into variables when you need to. $sub_query = "...." No magic.

"if you do know what you’re doing, it’s not bad to take shortcuts"...that's fine too, but how many web developers here thought to suggest to the original poster that he should not loop over all of his tasks and run a new query for each to get the comments? Without trying to sound boorish, when it comes to SQL, do you really know what you're doing? Did you think of - and could you write - the query I posted as a solution?

I sometimes use AR myself - the point about jquery is valid. It can be a good shortcut. The reason I preach against it I know far too many web developers who can't write any sort of simple query and will do ANYTHING to avoid writing sql. AR gives them one more excuse to avoid learning something that is essential to their work, and so they write terrible code in their sites like huge loops around every table and think that that's okay. AR hides everything away, so they can't even notice when they've coded something backwards


Messages In This Thread
Newbie Q - controller/view code for mixed query - by El Forum - 06-15-2011, 08:47 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-15-2011, 09:22 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-15-2011, 10:17 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-16-2011, 01:49 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-16-2011, 03:25 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-17-2011, 06:31 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-17-2011, 06:42 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-17-2011, 08:17 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 08:04 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 09:19 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 09:56 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 10:12 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 01:42 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 05:07 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 06:07 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 06:09 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 06:52 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-18-2011, 08:19 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 01:27 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 03:52 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 04:39 AM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 03:46 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 04:25 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 04:36 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 04:36 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 04:59 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 05:18 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 05:31 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 06:02 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 06:21 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 06:30 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 06:44 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 07:00 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 07:09 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 09:07 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 09:11 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-19-2011, 10:12 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 01:31 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 01:36 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 02:56 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 03:00 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 03:23 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 04:46 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 05:34 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 05:45 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 06:21 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 06:38 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-20-2011, 07:02 PM
Newbie Q - controller/view code for mixed query - by El Forum - 06-21-2011, 11:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB