phamodels/extensions/select_a_row_where.php
Antonio de la Rosa 19cd803a87 Fixes on modelform
2015-04-29 02:08:23 +02:00

37 lines
No EOL
998 B
PHP

<?php
/**
*
* @author Antonio de la Rosa <webmaster@web-t-sys.com>
* @file
* @package Core/ModelExtraMethods
*
*
*/
/**
* A useful method for Webmodel for load a row from a db model (table) using a where sql statement
*
* With this method you can load only a row specifyng the model id value using a where sql statement.
*
* @param Webmodel $class The instance of the class used
* @param string $where A where sql statement.
* @param array $arr_select An array where the values are the correspondent fields of the model
* @param boolean $raw_query If true, ForeignKeys will be ignored, if false, the return value will load the relationships specified.
* @param integer $assoc If 0, return only associatives keys, if 1, return numeric keys.
*
*/
function select_a_row_where_method_class($class, $where, $arr_select=array(), $raw_query=0, $assoc=0)
{
settype($idrow, 'integer');
$query=$class->select($where, $arr_select, $raw_query);
return $class->fetch_array($query, $assoc);
}
?>