Welcome Guest, Not a member yet? Register   Sign In
Echoing results from a database
#20

[eluser]TheFuzzy0ne[/eluser]
[quote author="mdcode" date="1236833345"]I appreciate any and all input...

Now, if I'm understanding you, and Fuzzy, correctly then I think that I am using the database correctly, since the things stored in these particular tables are rarely changing. The intro text, while only used on the front page for instance, is a 'large' block of text pulled from a TEXT type field in the database.

While the other items are quite small, such as the adminEmail and siteTitle, and could be held in a special config file, it seems superfluous to then hold the intro text in the database since it would then be the only item in there.

Thinking aloud, I guess then though, I could just make that static text on the home page just like the "Welcome to the" is right now, and drop two tables out of the db.[/quote]

My suggestion would be something like this:

In ./system/application/config/config.php:

Code:
$config['admin_email'] = '[email protected]';
$config['site_title'] = 'My Site';

The config file is automatically loaded by CodeIgniter, so you can grab the values using $this->config->item('site_title') and so on. You're free to change the data as you see fit, and it's probably easier than editing a database, as you just need to open a file and edit it.

Basically, the information will be there for you readily on each request - no need to mess about with databases. Consider a database table to be a bit like a big-ass CD rack. You wouldn't buy a CD rack capable of holding 200 CDs to hold only one CD, would you? ...Or would you?? The other reason for my suggestion is that you seem to be querying the database once for each setting, which is not very efficient.


Messages In This Thread
Echoing results from a database - by El Forum - 03-10-2009, 11:15 PM
Echoing results from a database - by El Forum - 03-10-2009, 11:22 PM
Echoing results from a database - by El Forum - 03-11-2009, 03:15 PM
Echoing results from a database - by El Forum - 03-11-2009, 03:42 PM
Echoing results from a database - by El Forum - 03-11-2009, 04:07 PM
Echoing results from a database - by El Forum - 03-11-2009, 04:21 PM
Echoing results from a database - by El Forum - 03-11-2009, 04:25 PM
Echoing results from a database - by El Forum - 03-11-2009, 04:54 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:07 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:16 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:22 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:26 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:32 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:34 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:43 PM
Echoing results from a database - by El Forum - 03-11-2009, 05:49 PM
Echoing results from a database - by El Forum - 03-11-2009, 06:06 PM
Echoing results from a database - by El Forum - 03-11-2009, 06:07 PM
Echoing results from a database - by El Forum - 03-11-2009, 06:11 PM
Echoing results from a database - by El Forum - 03-11-2009, 06:17 PM
Echoing results from a database - by El Forum - 03-11-2009, 06:55 PM
Echoing results from a database - by El Forum - 03-11-2009, 07:02 PM
Echoing results from a database - by El Forum - 03-11-2009, 07:05 PM
Echoing results from a database - by El Forum - 03-11-2009, 07:27 PM
Echoing results from a database - by El Forum - 03-11-2009, 07:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB