How to use Query Class
How to use Query Class
First: DataTable is incredible and Editor more.
I'm working with Editor DataTable and I want to filter the first sql query (where the information shown for first time), check the query class documentation and modify the Database/Query.php:
Query Class
protected $_type = "Mysql";
public static function connect ( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
return false;
}
public static function connect ( $user, $pass='mypass', $host='localhost', $port='', $db='mydb', $dsn='charset=utf8' )
{
return false;
}
I need show the entries where FechaFacura is equal to 2014-07-01 (for example)
And in my Database/Database.php:
public function select ( $table, $field="*", $where=null, $orderBy=null )
{
return $this->query( 'select' )
->table( $table )
->get( $field )
->where('FechaFactura', '2014-07-01')
->order( $orderBy )
->exec();
}
But nothing happens. I need to define my Database instance Contrstructor in another place?
Thanks in advance
This question has an accepted answers - jump to answer
Answers
Hi,
Changing the
select()
method in the Database.php file probably isn't the best idea as it would mean that all queries that useselect()
would have that condition applied!Is this an
Editor
class that you want to filter? If so, I would suggest using thewhere()
method. For example:Allan
Thanks for the reply Allan, I'll check.
DataTable is incredible.
:D
I use a staff.php, I put in my example by my DataTable Edit:
Thanks Allan, you so Big :D