Agreed, this is how I would recommend you do it. I would be careful
naming your include files with an .inc extension, though, since .inc
isn't parsed by PHP and will be shown as plain text when pulled up in a
web browser. I normally name them something like config.inc.php or
database.inc.php, etc. 

I've gotten into the habit, from working with GeekLog, to put everything
into a $_CONF array. 

$_CONF["database"] = "MySQL";
$_CONF["multiplier"] = 1.5;

etc...

---John Holmes...

> -----Original Message-----
> From: Richard Baskett [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 1:01 PM
> To: Erik Price; PHP General
> Subject: Re: [PHP] web application development question
> 
> I usually have an info.inc file that has all these variables that I
might
> need to change.  Then include it in the files that use those variables
and
> if I ever need to change one of them I just change it in the include
file
> and it updates everything that way..
> 
> Rick
> 
> Beauty of whatever kind, in its supreme development, invariably
excites
> the
> sensitive soul to tears. - Edgar Allan Poe
> 
> > From: Erik Price <[EMAIL PROTECTED]>
> > Date: Fri, 26 Apr 2002 15:50:08 -0400
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] web application development question
> >
> > For those of you who write web applications (in any language), what
do
> > you recommend as the best way to store arbitrary atomic data for the
web
> > application?  in other words, data that doesn't really need to be
stored
> > in a relational database, as it does not really relate to anything?
> >
> > In the app I am working on (PHP/MySQL), there are several instances
of
> > this.  One of them is:
> > a multiplier of 1.5 is applied to any "materials cost" of posters
> > ordered through my app.  That is, although the "materials cost" to
my
> > employer is, say $0.076 per square inch, 0.114 is the amount that we
> > charge per square inch (0.076 * 1.5).  However, this multiplier
could
> > change at some point in the future, so I am hesitant to leave the
number
> > hard-coded into my page.  I would rather have it stored in the
database,
> > where my employer can easily update or change it to another
multiplier.
> > But it seems awkward to create a table that simply maintains the
> > multiplier:
> >
> > mysql> SELECT * FROM material_multiplier;
> > +------------+
> > | multiplier |
> > +------------+
> > |       1.50 |
> > +------------+
> > 1 row in set (0.00 sec)
> >
> > I suppose I could store a table with two columns, one being VARNAME
the
> > other being VALUE, and pull this kind of standalone data out of it,
but
> > was curious what other people do when they need to store something
like
> > this.
> >
> >
> > Erik
> >
> >
> >
> >
> >
> > ----
> >
> > Erik Price
> > Web Developer Temp
> > Media Lab, H.H. Brown
> > [EMAIL PROTECTED]
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to