Skip to content

Instantly share code, notes, and snippets.

View biakaveron's full-sized avatar

Ivan Brotkin biakaveron

  • Russian Federation
View GitHub Profile
/**
* Count records for a given table
*
* @param string table name
* @param array WHERE conditions
* @return int
*/
public function count_records($table = FALSE, $where = NULL)
{
$this->_select = array(array('COUNT("*")', 'records_found'));
// modules/database/classes/database.php, Line 238
if (FALSE !== $dotpos = strpos($value, '.'))
{
if (substr($value, -1) == '*')
{
return $this->_identifier.substr($value, 0, $dotpos).$this->_identifier.'.*';
}
// Dots are used to separate schema, table, and column names
$value = str_replace('.', "{$this->_identifier}.{$this->_identifier}", $value);
}
@biakaveron
biakaveron / input.php
Created June 24, 2009 13:57
input helper
<?php defined('SYSPATH') or die('No direct script access.');
class Kohana_Input {
protected static $user_agent = FALSE;
public static function get($key = NULL, $default = NULL) {
return self::find_key($_GET, $key, $default);
}