From e816c84961436f34ac1b6516bf40377404d7a460 Mon Sep 17 00:00:00 2001 From: jchu Date: Wed, 15 Dec 2004 01:08:08 +0000 Subject: added function to get ids from names --- web/lib/pkgfuncs.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'web/lib') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index bfdaa58..5c3b24a 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -142,6 +142,26 @@ function pkgvotes_from_sid($sid="") { } +# get package details +# +function get_package_id_from_name($name="") { + global $_REQUEST; + global $pkgsearch_vars; + $pkg = 0; + $q = "SELECT ID "; + $q.= "FROM Packages "; + $q.= "WHERE Packages.Name = '".$name."'"; + $dbh = db_connect(); + $results = db_query($q, $dbh); + if (!$results) { + } else { + $pkg = mysql_fetch_assoc($results); + $pkg = $pkg['ID']; + } + return $pkg; +} + + # display package details # function package_details($id=0) { -- cgit v1.2.3-70-g09d2