2

I want to use Data Tables in Kohana 3.0, but in all examples they core PHP code and normal queries. Is there any tutorial or example on how to use Kohana with data tables ??

Example:

 $sQuery = "SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(",",$aColumns))."FROM $sTable $sWhere $sOrder $sLimit";

How to write this type of queries in Kohana like DB::select(...)? Give some good suggestions about writing queries in Kohana.

Raidri
  • 17,258
  • 9
  • 62
  • 65
Clarence
  • 896
  • 1
  • 9
  • 27

1 Answers1

1

You can try where_open() and where_close() method for where conditions..

For Example

$query = DB::select()
       ->from('table')
       ->where_open()
       ->where('column1', '=', 1)
       ->or_where('column2', '=', 2)
       ->where_close();

would produce the following SQL:

SELECT * FROM table WHERE (column1 = 1 OR column2 = 2);

You can find more about kohana sql select query builder on url given below.

http://kohanaframework.org/3.1/guide/database/query/builder

I hope it will be helpful for you,

thanks

Er. Anurag Jain
  • 1,780
  • 1
  • 11
  • 19