Welcome to WebmasterWorld Guest from 18.232.53.231

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Control mysql db with php

To clarify my conception of config.

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

Junior Member

10+ Year Member

joined:Jan 31, 2003
posts:66
votes: 0


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?

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

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:5016
votes: 53


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 ;)

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

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


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.
9:03 am on Feb 19, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 14, 2002
posts:118
votes: 0


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

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

Junior Member

10+ Year Member

joined:Jan 31, 2003
posts:66
votes: 0


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