[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
Re: [PHP-DB] functions IN the database.
*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
Re: [PHP-DB] formatting a timestamp
*This message was transferred with a trial version of CommuniGate(tm) Pro* Rick, You can use date() in the following fashion.. $timeStamp = time(); date('m-d-y : h-m', $timeStamp); where $timestamp is a unix epoch timestamp. Hope this helps! Rolf Brusletto http://www.phpexamples.net Rick Dahl wrote: *This message was transferred with a trial version of CommuniGate(tm) Pro* I want to print out a timestamp of length 14. I want to have it formatted like: mm-dd-yy : hh-mm I have looked but all I can find is how to format a date and I don't want that. I want the time also. Rick Don't burn the day...away ~ DJM _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Urgent help needed
Chris - it might take a little work, but I think I have a good solution for ya. I would maybe use the $id as the key, and then use hidden inputs to set the other stuff in a multidimensional array. like so input type=checkbox name=del[?=$id?][path] value=?=$path? input type=hidden name=del[?=$id?][title] value=?=$title then, on the flip side of the script when you need the data, the array keys are the actual id's you need, and the multidimensional array has keys of [path] and [title] like below $del[1][path] == '/home/monkey'; $del[1][title] == 'monkeystuff'; $del[2][path] == 'home/donkey/'; $del[2][title] == 'donkeystuff'; you can access this array by doing the following... foreach($del as $id = $slot) { echo $id.'br /'; echo 'path = '.$slot[path].'br /'; echo 'title = '.$slot[title].'br /'; } Hope this helps... Rolf Brusletto phpExamples.net http://www.phpExamples.net Chris Payne wrote: Hi there everyone, I have this system where you can create folders on your HD for inserting PDF files via a web interface and you can also remove these folders, this works no problem, but I have run into a snag, I need to send more than 1 field in the below array via a form, how can I do? Basically, aswell as sending the ID, I need to send the title and path too and i'm abit confused. input type=checkbox name=del[] value=?=$id? Any help would be VERY appreciated :-) Thanks everyone. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] redirect
Dan Liu wrote: Hi all, Has anyone used 'Module mod_rewrite URL Rewriting Engine'? I need to do a redirect from http://url1/cgi-bin/mapserv?map=/dir1/county.map to http://url2/cgi-bin/mapserv?map=/dir2/county.map But it is not working. Does somebody know why? Thanks in Advance. Dan Dan - without seeing the rewrite code.. its sorta hard to tell why it wouldn't be working!!! simply put, if your host allows you to use a .htaccess and mod_rewrite.. in the .htaccess RewriteEngine On RewriteRule /usage.html /usage/index.html Where /usage.html is the file that was requested, and /usage/index.html is the file that it needs to go to. Rolf Brusletto www.phpExamples.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php