⚠ 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

SELECT `table`. FROM `table`



manusimpson
  • profile picture
  • Member

Posted 31 May 2018 - 16:43 PM

Hi guys, I'm new in Grocery world so I hope do not ask a silly question.

I did one function in my controller that works great even with multiple table relation, but now I did another function with a very very simple crud and I'm getting this error, like that the query is being created without selecting fields o *.

 

This is my code:

public function historico()
{
	if($this->session->is_session){
		$crud = new grocery_CRUD();
		$crud->set_table('historico');
		$output = $crud->render();
		$output->css_files[] = base_url() . 'assets/bootstrap/css/bootstrap.min.css';
		$output->js_files[] = base_url() . 'assets/bootstrap/js/bootstrap.min.js';
		$this->load->view('historico', $output);
	}else{
		$this->login();
	}
}

and response:

 

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `historico`' at line 2

SELECT `historico`. FROM `historico`

Filename: [***]/system/database/DB_driver.php

Line Number: 691

 

Thanks for reply.

 

Manuel.-

 


JavaBean
  • profile picture
  • Member

Posted 14 June 2018 - 08:53 AM

Hi Manuel

I've just had the same problem.

You are missing a PRIMARY INDEX on your 'historico' table.

Thanks

David