Re: Dynamically creating PHP before it is executed

From: Date: Sat, 09 Mar 2002 04:18:18 +0000
Subject: Re: Dynamically creating PHP before it is executed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-87846@lists.php.net to get a copy of this message
I don't quite understand why you chose such a complicated solution - I may be missing something, in which case sorry for wasting your time. But why don't you just dynamically build the select statement and then use the <whatever>_fetch_array() -- and walk that array instead? Just my 2c Bogdan Jonathan Duncan wrote:
I am trying to figure out a way to dynamically create some lines of PHP code and then have it executed. This is because I want a page to display different columns in a table depending on whatever link is clicked. There are hundreds of different combinations of column headings so I don't want to make a different PHP page that is formated for each different combination. The column headings are stored in a database. So far what I have come up with is to have a starting page, that takes the value of the link that is clicked, it queries the database for that value and then does a while statement to make all the <TD>'s for the different columns. Each <TD> is populated with a different variable, one for each column header. Each iteration I append to a variable to hold all of these <TD>'s. Then I write the contents of that variable to a temporary include file and call the page that will display the table. That table then includes those <TD>'s from the include file I wrote them to and executes the PHP that runs another query on the database and fills in the variables in those <TD>'s. This seems like a lot of work. Does what I am trying to do make sense to anyone? Does anyone have any idea how to do this an easier way? Thanks Jonathan Duncan


« previous php.general (#87846) next »