Welcome Guest, Not a member yet? Register   Sign In
Too many db queries
#1

[eluser]Haskabab[/eluser]
What's up!

I'm building a browser game with codeigniter, and I've tried to organize the many functions of my game into their categorized library. But many libraries make use of each other.

I have my Character library, with the function get( $id )

And i have (22+) other libraries, for example:

Stats library, also with a lot of functions; like heal / damage etc..
Inventory
etc...

And all these libraries need the character information in order to know how to proceed, so my character->get() function gets called 22 times each time i load a page!

So that's 22 queries pulling the exact same data.

Now my question is, is there any way to reduce the amount of queries without storing the database information in a session or in a variable somewhere in codeigniter, since this information is updated every time you refresh the page and it's essential the exact same data from the database is displayed.




Theme © iAndrew 2016 - Forum software by © MyBB