Russ -
    That's exactly what I'm doing with this GIS application I'm working on (I may not 
have understood your
original question?) Here's the general design (although it's all OOP so it's a little 
less clearcut):

1) Table with "projects" in it - contains basemap, associated datatable(s), and which 
fields in the datatables
are to be displayed in different "modes". This table is generated through a (2-step) 
form, in which the user
selects or creates the datatable and basemap, and then chooses the fields to display 
and the fields to hide, in
different circumstances, using multiple selects. The list of fields is stored as an 
explode()ed array, with
commas between the field names (exactly what you'd want for a MySQL query).

2) When a map project is requested through another script, the "projects" table is 
queried first. This table
contains the info described above, so using the tablename and the list of fields and a 
little adjustment of the
field name list we formulate our final query.

if it weren't oop:
<?php
    db_connect($database);
    $result = mysql_query("SELECT datatable, flist_a FROM projects WHERE id='$id'");
    if($result) { while(list($datatable, $flist_a) = mysql_fetch_array($result)) {
        $final_result = mysql_query("SELECT $flist_a FROM $datatable");
    }
    }
?>

General idea's the same as what you're looking for - you could "admin" each 
application with a script that
updates the equivalent of the "projects" table, and direct all your queries through 
this table first. You could
implement "modes" using different records or columns in the "projects" table, or even 
reading these parameters
out of a flat file, like "config.ini.php" or something along those lines, that you 
could easily edit.

cheers,
db



Russ Michell wrote:

> > Russ -
> >Why not (MySQL) extract the field always, and code into your (php) generic 
>mechanism whether or
> not a
> > particular field under that name appears? Using mysql_fetch_assoc() you could 
>exclude 'modified' from
> > your generic mechanism under particular circumstances. This avoids coding it into 
>your query, so it may
> > be classified as a cludgeon, but it would work.
>
> Hi Daniel:
>
> I get what you're saying, but I'm still having to hard-code it somewhere into my 
>scripts. I'm
> working on a method of defining fields to include/exclude using arrays whose values 
>are given for
> each application this system is applied to. (That'll keep me busy)
>
> Thanks for your help.
> Russ
>
> On Fri, 14 Dec 2001 12:15:01 -0800 Daniel Barton <[EMAIL PROTECTED]> wrote:
>
> > Russ -
> >     Why not (MySQL) extract the field always, and code into your (php) generic 
>mechanism whether or not a
> > particular field under that name appears? Using mysql_fetch_assoc() you could 
>exclude 'modified' from
> > your generic mechanism under particular circumstances. This avoids coding it into 
>your query, so it may
> > be classified as a cludgeon, but it would work.
> >
> > cheers,
> > db
> >
> > Russ Michell wrote:
> >
> > > Sorry! just read-read my post, it should have been:
> > >
> > > ....particular column ('modified') *NOT* to appear under specific circumstances, 
>somewhere
> > along... >
> > > Cheers. > Russ
> > > > On Thu, 13 Dec 2001 12:03:09 +0000 (GMT Standard Time) Russ Michell 
><[EMAIL PROTECTED]>
> > wrote: >
> > > > Hi there everyone: > >
> > > > I have a genericphp/MySQL search+retrival mechanism. Generic in that it takes 
>table names, > >
> > fieldnames and fieldtypes as form lables and element names. However, because of 
>this I cannot > >
> > hard-code my SQL queries as they need to be as generic (univerally useful) as 
>possible. > >
> > > > I therefore have a lot of "SELECT * FROM <table_name>..." queries. However I 
>would like to be
> > able > > to specify a particular column ('modified') to appear under specific 
>circumstances,
> > somewhere along > > the lines of: "SELECT *,!modified FROM <table_name> .." I 
>scanned TFM and
> > couldn't find anything > > specific to my problem. I have an incling this may not 
>be as easy as I
> > think, so does anyone know > > of a bodge,kludge or workaround??
> > > > > > Thanks for your time.
> > > > Russ > >
> > > > #-------------------------------------------------------# > >
> > > >   "Believe nothing - consider everything" > >
> > > >   Russ Michell > >   Anglia Polytechnic University Webteam
> > > >   Room 1C 'The Eastings' East Road, Cambridge > >
> > > >   e: [EMAIL PROTECTED] > >   w: www.apu.ac.uk/webteam
> > > > > >   www.theruss.com
> > > > > > #-------------------------------------------------------#
> > > > > >
> > > > -- > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional 
>commands, e-mail:
> > [EMAIL PROTECTED] > > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED] > >
> > > > #-------------------------------------------------------#
> > > >   "Believe nothing - consider everything"
> > > >   Russ Michell
> > >   Anglia Polytechnic University Webteam >   Room 1C 'The Eastings' East Road, 
>Cambridge
> > > >   e: [EMAIL PROTECTED]
> > >   w: www.apu.ac.uk/webteam >
> > >   www.theruss.com >
> > > #-------------------------------------------------------# >
> > > -- > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional 
>commands, e-mail:
> > [EMAIL PROTECTED] > To contact the list administrators, e-mail: 
>[EMAIL PROTECTED]
> >
> > --
> > ---------- Dan Barton
> > Terrestrial Program Biologist Asst. Data Manager
> > Point Reyes Bird Observatory http://www.prbo.org
> > [EMAIL PROTECTED] [EMAIL PROTECTED]
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
> #-------------------------------------------------------#
>
>   "Believe nothing - consider everything"
>
>   Russ Michell
>   Anglia Polytechnic University Webteam
>   Room 1C 'The Eastings' East Road, Cambridge
>
>   e: [EMAIL PROTECTED]
>   w: www.apu.ac.uk/webteam
>
>   www.theruss.com
>
> #-------------------------------------------------------#

--
----------
Dan Barton
Terrestrial Program Biologist
Asst. Data Manager
Point Reyes Bird Observatory
http://www.prbo.org
[EMAIL PROTECTED]
[EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to