Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
vintprox173930dThere is always a better way: to avoid what you say you want in the first place. What's the goal in it, by the way? If it's SQL and you intend to combine values from related tables, there is (LEFT) JOIN.
C0D46227230dWhere's your query(s), this feels like it's queried incorrectly and then attempted to be mashed back together.
Hazarth194330d3 for-eaches in a single function are a bit of a red-flag to me
You should be able to just query and join the data on SQL side and then a single cycle should be enough
This feels like you did 3 queries for 3 tables and then tried to join them in code by going over all of them...
That's probably what that first IF does...
That's gonna be messy and slow as hell on bigger tables because it grows exponentially...