Commit 66d330cc27ae6ecc35af0e59a46f60b63158b16d
1 parent
8b22da36
added lookup_id function
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@117 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
24 additions
and
1 deletions
lib/owl.lib.php
| ... | ... | @@ -951,6 +951,28 @@ function group_to_name($id) |
| 951 | 951 | return $sql->f("name"); |
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | + | |
| 955 | +/** | |
| 956 | + * Performs an id field lookup on the specified table. | |
| 957 | + * | |
| 958 | + * @param $tableName | |
| 959 | + * the name of table to perform the id lookup. | |
| 960 | + * @param $fieldName | |
| 961 | + * the db field to return. | |
| 962 | + * @param $fieldValue | |
| 963 | + * the value to perform the lookup for | |
| 964 | + * @return the id of the row in the db with $fieldName=$fieldValue | |
| 965 | + */ | |
| 966 | + | |
| 967 | +function lookup_id($tableName, $fieldName, $fieldValue) | |
| 968 | +{ | |
| 969 | + $sql = new Owl_DB; | |
| 970 | + $sql->query("select id from $tableName where $fieldName = '$fieldValue'"); | |
| 971 | + while($sql->next_record()) | |
| 972 | + { | |
| 973 | + return $sql->f("id"); | |
| 974 | + } | |
| 975 | +} | |
| 954 | 976 | //------------------------------------------------------------ |
| 955 | 977 | /** |
| 956 | 978 | * Function uid_to_name($id) |
| ... | ... | @@ -1615,6 +1637,7 @@ function printgroupperm($currentval, $namevariable, $printmessage, $type) { |
| 1615 | 1637 | * and loading the default language |
| 1616 | 1638 | */ |
| 1617 | 1639 | // make request parameters global |
| 1640 | +/* | |
| 1618 | 1641 | if (substr(phpversion(),0,5) >= "4.1.0") { |
| 1619 | 1642 | // if supported by the installed version of PHP |
| 1620 | 1643 | import_request_variables('pgc'); |
| ... | ... | @@ -1638,7 +1661,7 @@ if (substr(phpversion(),0,5) >= "4.1.0") { |
| 1638 | 1661 | extract($HTTP_POST_FILES); |
| 1639 | 1662 | } |
| 1640 | 1663 | } |
| 1641 | - | |
| 1664 | +*/ | |
| 1642 | 1665 | /* |
| 1643 | 1666 | // initialise session var |
| 1644 | 1667 | if(!isset($sess)) { | ... | ... |