/** * Will return a MySQL Resource, containing the result of the passed SQL. This method will query the database and return the * MySQL resource which will get processed and transformed into a specifc RA array (A) that you can then access for information * you actually need; * * @param S $queryString The query string to be queried * @param S $queryField The field name (unique) to index by * @return A The returned query resource * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 11_SQL.php 313 2009-10-09 13:27:52Z catalin.zamfir $ * @since Version 1.0 * @access public * @static */ public static function getQuery(S $queryString, S $queryFieldId = NULL) { // Get the MySQL result, or go an echo an error screen if it failed ... $queryResource = new O(mysql_query($queryString->doToken(SQL_PREFIX, self::$objSQLR))); // Do another checking for FALSE, and return what's needed ... if ($queryResource->checkIs('res')->toBoolean()) { $queryResourceSet = new R($queryResource->toMix()); $arrayResourceSet = new A(); if ($queryFieldId == NULL) { // Set the indexer to minus 1, so we can ++i; $i = -1; // Do the looping ... while ($r = self::getQueryResultRow($queryResourceSet)) { // MySQL: Numeric ... $arrayResourceSet[++$i] = $r; } // Just do it; return $arrayResourceSet; } else { // Do the looping ... while ($r = self::getQueryResultRow($queryResourceSet)) { // MySQL: Associative ... $arrayResourceSet[$r[$queryFieldId->toString()]] = $r; } // Just return, we know what it is; return $arrayResourceSet; } } else { if ($queryResource->checkIs('bln')->toBoolean()) { if ($queryResource->toMix() == TRUE) { // Return TRUE, is not a resource ... return new B(TRUE); } else { // Return FALSE, output error screen; self::renderSQLScreenOfDeath(); } } } }