Browse Source

[svn r13785] Added the missing Database::result() method to replace mysql_result() everywhere

Yannick Warnier 17 years ago
parent
commit
1599ba7825
1 changed files with 19 additions and 2 deletions
  1. 19 2
      main/inc/lib/database.lib.php

+ 19 - 2
main/inc/lib/database.lib.php

@@ -664,8 +664,25 @@ class Database
 		$database_name_with_glue = Database::fix_database_parameter($database_name);
 		return Database::format_glued_course_table_name($database_name_with_glue, CHAT_CONNECTED_TABLE);
 	}
-
-
+	/**
+	 * Acts as the relative *_result() function of most DB drivers and fetches a
+	 * specific line and a field
+	 * @param	resource	The database resource to get data from
+	 * @param	integer		The row number
+	 * @param	string		Optional field name or number
+	 * @result	mixed		One cell of the result, or FALSE on error
+	 */
+	function result($resource,$row,$field='')
+	{
+		if(!empty($field))
+		{
+			return mysql_result($resource,$row,$field);
+		}
+		else
+		{
+			return mysql_result($resource,$row);
+		}
+	}
 }
 //end class Database
 ?>