[PHP-DB] functions IN the database.

2003-05-31 Thread Rolf Brusletto
*This message was transferred with a trial version of CommuniGate(tm) Pro*
Hey all -
I'm curious if anybody has ever setup the logic to put php functions 
into a database here is my thinkin on it, hopefully I can get some 
suggestions on the benefits, downsides, etc.

(in mysql)

CREATE TABLE `functions` (`functionId` INT (5)  UNSIGNED DEFAULT '0' NOT 
NULL AUTO_INCREMENT,
   `functionData` TEXT NOT 
NULL,
   `functionDesc` TEXT, 
PRIMARY KEY(`functionId`), UNIQUE(`functionId`));

INSERT INTO functions(functionData, functionDesc)
VALUES('function echoNumber($number)
   { echo $number; }',
'This function echos out a given $number');
(in php)
$sql = SELECT functionData
   FROM functions;
$query = mysql_query($sql);
while($functionData = mysql_fetch_assoc($query)) {
   eval $functionData[functionData];
};
This in theory **should initiate the given functions listed in the 
functions table, has anybody used anything like this? I have a two sites 
that I NEED to use the same functions and this is the first thing that 
comes to mind, plus it would allow for  gui editing  of or creating 
functions via a secured webpage.

Thanks on advance!

Rolf Brusletto
http://www.phpexamples.net
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] functions IN the database.

2003-05-31 Thread Becoming Digital
Forgive me if I'm overlooking something, but why not just use a class?

Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message - 
From: Rolf Brusletto [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 30 May, 2003 17:10
Subject: [PHP-DB] functions IN the database.


*This message was transferred with a trial version of CommuniGate(tm) Pro*
Hey all -

I'm curious if anybody has ever setup the logic to put php functions 
into a database here is my thinkin on it, hopefully I can get some 
suggestions on the benefits, downsides, etc.

(in mysql)

CREATE TABLE `functions` (`functionId` INT (5)  UNSIGNED DEFAULT '0' NOT 
NULL AUTO_INCREMENT,
`functionData` TEXT NOT 
NULL,
`functionDesc` TEXT, 
PRIMARY KEY(`functionId`), UNIQUE(`functionId`));

INSERT INTO functions(functionData, functionDesc)
VALUES('function echoNumber($number)
{ echo $number; }',
 'This function echos out a given $number');

(in php)
$sql = SELECT functionData
FROM functions;
$query = mysql_query($sql);
while($functionData = mysql_fetch_assoc($query)) {
eval $functionData[functionData];
};

This in theory **should initiate the given functions listed in the 
functions table, has anybody used anything like this? I have a two sites 
that I NEED to use the same functions and this is the first thing that 
comes to mind, plus it would allow for  gui editing  of or creating 
functions via a secured webpage.

Thanks on advance!

Rolf Brusletto
http://www.phpexamples.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] functions IN the database.

2003-05-31 Thread Rolf Brusletto
*This message was transferred with a trial version of CommuniGate(tm) Pro*
the sites will reside on different boxes. Thus needing a way to share 
the functions. I'm trying to get away from having two sets of code that 
do exactly the same thing.

Becoming Digital wrote:

Forgive me if I'm overlooking something, but why not just use a class?

Edward Dudlik
Becoming Digital
www.becomingdigital.com
- Original Message - 
From: Rolf Brusletto [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, 30 May, 2003 17:10
Subject: [PHP-DB] functions IN the database.



Hey all -

I'm curious if anybody has ever setup the logic to put php functions 
into a database here is my thinkin on it, hopefully I can get some 
suggestions on the benefits, downsides, etc.

(in mysql)

CREATE TABLE `functions` (`functionId` INT (5)  UNSIGNED DEFAULT '0' NOT 
NULL AUTO_INCREMENT,
   `functionData` TEXT NOT 
NULL,
   `functionDesc` TEXT, 
PRIMARY KEY(`functionId`), UNIQUE(`functionId`));

INSERT INTO functions(functionData, functionDesc)
VALUES('function echoNumber($number)
   { echo $number; }',
'This function echos out a given $number');
(in php)
$sql = SELECT functionData
   FROM functions;
$query = mysql_query($sql);
while($functionData = mysql_fetch_assoc($query)) {
   eval $functionData[functionData];
};
This in theory **should initiate the given functions listed in the 
functions table, has anybody used anything like this? I have a two sites 
that I NEED to use the same functions and this is the first thing that 
comes to mind, plus it would allow for  gui editing  of or creating 
functions via a secured webpage.

Thanks on advance!

Rolf Brusletto
http://www.phpexamples.net
 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php