This topic is locked

reducing duplicate files for one database

10/25/2005 8:52:12 AM
PHPRunner General questions
rjks author

Hi,
I am trying to reduce the number of generated files required when a table is filered over a field value.
Example:
Database sys_vorlauf has a column art, art is an integer.
I can generate one set of files for each value
art=1 sys_vorlauf_list_01.php sys_vorlauf_add_01.php and so on.
If I have 100 different art values I become 1200 files all of which have to be edited to change the calls e.g. sys_vorlauf_add.php to sys_vorlauf_add_01.php.
for a programm which is meant to save time this does the reverse.
If I can send the value of sys_vorlauf.art each time to a variable $vorlaufart then I only require 12 pages instead of n times the art types.
In the include directory is a file sys_vorlauf_variables.php where the gstrSQL is filled and when I edit the SQL String in PHPRunner it is stored here:
$gstrSQL = "select `_kenn`, `art`, `nummer`, `Bezeichnung`, `zahl01`, `zahl02`, `string01`, `string02`, `text1` From `sys_vorlauf` WHERE `art` = 3";
Can I use a variable i.e. $vorlaufart to set the WHERE
$gstrSQL = "select `_kenn`, `art`, `nummer`, `Bezeichnung`, `zahl01`, `zahl02`, `string01`, `string02`, `text1` From `sys_vorlauf` WHERE `art` = <?$vorlaufart?>";
I tried this of course but I keep getting errors and the Value of $vorlaufart gets lost.
I have a pulldown menu system and call the php files correctly as in the generated links.
Now to my questions.
Where must I set the variable $vorlaufart?
Which pages must I change.
How do I call a new page with the art Value without causing other variable values to get lost.
Thanks in advance for your help.
if required I can send the source code.
Robert KS

rjks author 10/25/2005

Hi,
I thought I´d give a clearer example of the problem.
I would like to use the sysvorlauf***.php files for different valuese of art.
art = 1 is for groups

art = 2 is for material
and so on
I define a variable $artvorlauf = 0 in sys_vorlauf_variables.php dbcommon
If I set the where filter to art = $artvorlauf and echo it I get the correct result.
Here the lines in sys_vorlauf_variables.php
$vorlaufart=3;
$gstrSQL = "select `_kenn`, `art`, `nummer`, `Bezeichnung`, `zahl01`, `zahl02`, `string01`, `string02`, `text1` From `sys_vorlauf` WHERE `art`=".$vorlaufart;
Which means it will work, but where can I define the Variable so that it will be global, do I have to use hidden to give it to each file??
thanks again in advance.
Robert KS
$gstrSQL = "select `_kenn`, `art`, `nummer`, `Bezeichnung`, `zahl01`, `zahl02`, `string01`, `string02`, `text1` From `sys_vorlauf` WHERE `art`=".$vorlaufart;

Sergey Kornilov admin 10/26/2005

Robert,
you can define this variable in the beginning of include/dbconnection.php file.

rjks author 10/27/2005

Morgen Sergey,
well its morgings in Germany.
Thanks for the Tip.
I tried declaring the variable in ddconnection, the problem was I coudn´t transfer the value even using $GLOBALS, it was either empty or only had the initial value.
I am now using $_SESION() to transfer the Variable and a call parameter i.e sys_vorlauf_list.php?aktart=1
this works but the variable is of course visible when called. If I declare the variable in dbconnection it gets over writen when *_list.php is called and loses its value. which I give it in menu.php.
any ideas??
Robert