Magellan Linux

Diff of /alx-src/trunk/alx-web/include/basesql.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 420 by niro, Mon Oct 10 19:42:06 2005 UTC revision 421 by niro, Wed Jun 4 21:31:26 2008 UTC
# Line 38  Line 38 
38   }   }
39    
40   // Holt ein array mit den Results einer MySQL-Abfrage   // Holt ein array mit den Results einer MySQL-Abfrage
41   function sqlarr($query, $arrkey='')   function sqlarr($query, $arrkey='', $arrval='')
42   {   {
43   $arr = array();   $arr = array();
44    
45   $result = mysql_query($query) or die("Anfrage fehlgeschlagen: " . mysql_error());   $result = mysql_query($query) or die("Anfrage fehlgeschlagen: " . mysql_error());
46   while ($line = mysql_fetch_array($result, MYSQL_ASSOC))   while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
47   {   {
48   if($arrkey=='') $arr[] = $line;   if($arrval=='')
49   else $arr[$line[$arrkey]] = $line;   {
50     if($arrkey=='') $arr[] = $line;
51     else $arr[$line[$arrkey]] = $line;
52     }
53     else
54     {
55     if($arrkey=='') $arr[] = $line[$arrval];
56     else $arr[$line[$arrkey]] = $line[$arrval];
57     }
58   }   }
59    
60   return $arr;   return $arr;

Legend:
Removed from v.420  
changed lines
  Added in v.421