WIKINDX METHODS

Method:
fetchOne()

Class:
SQL

Method Call:
include_once("core/sql/SQL.php");
$db = new SQL();
STRING $db->fetchOne(ADODB_RECORDSET: $recordset);

Description: Returns a string based on $recordset and is a quick way to return just one value only from the database. Internally, it creates an indexed array from $recordset then returns only the 0th (the first) index.

Usage:

For example (assuming the database object exists within a class as $this->db):

	$field = array("title");
	$condition = "WHERE $id = " . $this->db->tidyInput(666);
	$recordset = $this->db->select(array("WKX_resource"), $field, $condition);
	$title = $this->db->fetchOne($recordset);

WIKINDX home      WIKINDX usage      WIKINDX classes