[eluser]elmne[/eluser]
I have this problem while trying to run a query in a class/model
Code:
$this->customer_type_id = $this->input->post('customer_type_id');
$this->customer_type = $this->input->post('customer_type');
if ( !( $this->input->post('customer_type_id')))
{
$query = $this->db->query('SELECT customer_type_id, customer_type FROM customer_type WHERE customer_type = "$this->customer_type" AND record_status IS NULL');
}
else
{
$query = $this->db->query('SELECT customer_type_id, customer_type FROM customer_type WHERE customer_type_id = "$this->customer_type_id" AND record_status IS NULL');
}
The query fails to produce a result,
But when i run the sql directly against the database, taking out the variable, like this
Code:
SELECT customer_type_id, customer_type FROM customer_type WHERE customer_type_id = "$this->customer_type_id" AND record_status IS NULL
I get a result.
What's the cause of the failure to return a result?