WIKINDX METHODS

Method:
formatAlias()

Class:
SQL

Method Call:
include_once("core/sql/SQL.php");
$db = new SQL();
STRING $db->formatAlias(ASSOC_ARRAY: $array);

Description:
Format an associative array as a SQL alias clause.

insert(), select() and selectNoExecute() will automatically call this method if necessary.

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

	$tables = array(array("WKX_resource" => "res"), "WKX_collection");
	$fields = array(array("WKX_resource.title" => "resT"), array("WKX_collection.title" => "collT"));
	$condition = "WHERE " . $this->db->formatField('id')  . "=" . $this->db->tidyInput(666);
	$recordset = $this->db->select($tables, $fields, $condition);
The SQL statement executed would be:
	"SELECT `WKX_resource`.`title` AS `resT`, `WKX_collection`.`title` AS `collT` FROM `WKX_resource` AS `res`, `WKX_collection` WHERE `id`='666'"

WIKINDX home      WIKINDX usage      WIKINDX classes