From 66d330cc27ae6ecc35af0e59a46f60b63158b16d Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 10 Jan 2003 15:28:05 +0000 Subject: [PATCH] added lookup_id function --- lib/owl.lib.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/owl.lib.php b/lib/owl.lib.php index 71f503a..03a1051 100755 --- a/lib/owl.lib.php +++ b/lib/owl.lib.php @@ -951,6 +951,28 @@ function group_to_name($id) return $sql->f("name"); } } + +/** + * Performs an id field lookup on the specified table. + * + * @param $tableName + * the name of table to perform the id lookup. + * @param $fieldName + * the db field to return. + * @param $fieldValue + * the value to perform the lookup for + * @return the id of the row in the db with $fieldName=$fieldValue + */ + +function lookup_id($tableName, $fieldName, $fieldValue) +{ + $sql = new Owl_DB; + $sql->query("select id from $tableName where $fieldName = '$fieldValue'"); + while($sql->next_record()) + { + return $sql->f("id"); + } +} //------------------------------------------------------------ /** * Function uid_to_name($id) @@ -1615,6 +1637,7 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { * and loading the default language */ // make request parameters global +/* if (substr(phpversion(),0,5) >= "4.1.0") { // if supported by the installed version of PHP import_request_variables('pgc'); @@ -1638,7 +1661,7 @@ if (substr(phpversion(),0,5) >= "4.1.0") { extract($HTTP_POST_FILES); } } - +*/ /* // initialise session var if(!isset($sess)) { -- libgit2 0.21.4