Welcome Guest, Not a member yet? Register   Sign In
Assignment of Query value to local variable
#1

[eluser]shahnawazahmed[/eluser]
Hey everyone ,

i am new to programming and codeigniter as well, i am facing minor issue in getting value from the sql query

here it is

$this->db->where('email_address', $this->input->post('email_address'));

i want to assign the email_address value to the $email local variable ..

please give me a tip

Thank you
#2

[eluser]shahnawazahmed[/eluser]
please reply someone ..
#3

[eluser]yacman[/eluser]
Code:
$this->db->where(‘email_address’, $this->input->post(‘email_address’));

If your controller is receiving a posted variable with the name of email_address, then this single line of code is correct for preparing a database query with a where statement of
Code:
WHERE email_address = '[email protected]'

I can't tell because of the lack of info, but you still need to call:
Code:
$query_result = $this->db->get('YOURTABLENAME');

$result = array();
if (!empty($query_result) && $query->num_rows() > 0) {
  $result = $query_result->result();
  $query_result->free_result();
}

print_r($result);

Good Luck! Try some tutorials http://www.youtube.com/watch?v=SSE9mTLWmKs
#4

[eluser]shahnawazahmed[/eluser]
Thank you for your response yacman Smile .




Theme © iAndrew 2016 - Forum software by © MyBB