⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Load problem in huge database



veer
  • profile picture
  • Member

Posted 08 August 2012 - 07:53 AM

HI

I stucked getting limiteded values through pagination Here is my code

$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_model('Indent_list_model');
$crud->set_table('in_po_order');
$crud->columns('indent_id','user','indent_time','supplier_id','indent_value','terms');
//$crud->set_relation('user','membership','first_name');
//$crud->set_relation('supplier_id','add_suppliers','sup_name');
$crud->display_as('indent_id','Indent Number');
$crud->display_as('user','created by');
$crud->display_as('indent_time','created on');
$crud->display_as('terms','View');
$crud->display_as('supplier_id','Supplier Name');
$crud->set_subject('Indent Order');
$crud->callback_column('terms', array($this, 'indent_view_link'));
$crud->unset_add();
$crud->unset_edit();
$crud->unset_delete();
$output = $crud->render();
$this->_example_output($output);

I am getting all values at once


here is my model


$select = "{$this->table_name}.*";
// ADD YOUR SELECT FROM JOIN HERE <------------------------------------------------------
// for example $select .= ", user_log.created_date, user_log.update_date";


$results = $this->db->query("SELECT @p:=`indent_id` as indent_id,@u:=`user`,(select first_name from member where [email="id=@u"]id=@u[/email]) as user,`indent_time`,@s:=`supplier_id`,(select sup_name from add_suppliers where [email="id=@s"]id=@s[/email]) as supplier_id,`terms`,(select sum(qty*price) from indent_po_item where [email="indent_id=@p"]indent_id=@p[/email]) as indent_value FROM `in_po_order` ")->result();

return $results;


Can any body help
Thanks