Forum Moderators: coopster

Message Too Old, No Replies

Control mysql db with php

To clarify my conception of config.

         

russgri

5:36 pm on Feb 18, 2003 (gmt 0)

10+ Year Member



I have a application that I need to write.
I need to control with a config statement/page

this newbie has concluded that...
a file called...say...config.php place in the root folder with variables/functins/classes defined would control every call of those v/f/c/ in subfolders.

Is there a standard control page floating around that would save me re-inventing the wheel?

brotherhood of LAN

2:10 am on Feb 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



so you want the variables in the config.php script to be "active" in every page in a folder?

You might want to take a look at mod_rewrite / .htaccess (there is loads of info in the site search and also members!).....you could include the config.php in every file under a folder using an .htaccess file.

I would write code here for you but it may be incorrect so I'll leave it to those in the know ;)

jatar_k

4:31 am on Feb 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Don't know of any standard, you may be able to find one if you look for free scripts that are geared to do what you want.

Allen

9:03 am on Feb 19, 2003 (gmt 0)

10+ Year Member



This sounds like what you're trying to do. This is my standard code:


if (isset ($_GET['action'])) {
$_POST['action'] = $_GET['action'];
}

switch ($_POST['action']) {
case "add":
require ("add.inc");
add ();
break;

case "delete":
require ("delete.inc");
delete ();
break;

default:
require ("menu.inc");
menu ();
break;
}

Allen

russgri

11:32 am on Feb 19, 2003 (gmt 0)

10+ Year Member



Thanks Allen,
I wanted to get the control on...say...config.php in the root folder and have the syntax to put on each page to have that page refer to and be controlled by config.php

Now is it necessary to have the reference on each page or does it inherit the variable without any reference?....
OOPS! I just remember seeing and include statement on each page in my admin folder here is the common code.

<code>
<?
include("config.php");
include("genlib.php");
$textpart = "browsedocs";
include("getlang.php");
include("$mylanguage/text.php");

db_connect($database_host,$database_name,$database_username,$database_password) or exit;
</code>
I am literally learning as I compose this message...a little like talking myself in the right path...

I am assuming that PHP core functions are inherited without any reference other than in php.ini in the servers PHP installation. (I am on a Shared Unix Linux Server)

Would it be advantageous for me to check a standard php.ini file to see just what is in there?...never thought of it until now..

My goal is to set up a database driven site that I can cookie cutter in a situation where I host in a community oriented environment.
Along the way I hope to become proficient in PHP/MySql