Welcome Guest, Not a member yet? Register   Sign In
Passing Variables to SQL Query
#2

(This post was last modified: 05-07-2015, 02:17 AM by casa.)

about your function, your query is not protected
PHP Code:
$query $this->db->get_where("table_name", array('column' => $data));
// or 
$sql "SELECT * FROM table_name where column =  ?" ;
$query $this->db->query($sql, array($data)) ; 
About session variable,(documentation about CI is very good)
PHP Code:
// create a session variable
$this->session->set_userdata('name''value') ;
// call a session variable
$this->session->userdata('name') ; // return 'value' 
About use function
PHP Code:
// some codes ...
 //...
  
$this->Model_name->functionname($this->session->userdata('name')) ; 
Reply


Messages In This Thread
Passing Variables to SQL Query - by Wolrab - 05-05-2015, 04:04 PM
RE: Passing Variables to SQL Query - by casa - 05-07-2015, 02:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB