Welcome Guest, Not a member yet? Register   Sign In
4096 CI_DB_mysql_result could not be converted to string
#1

[eluser]Unknown[/eluser]
ERROR: 4096
MESSAGE: 4096 CI_DB_mysql_result could not be converted to string
LINE = '**'

CODE:
Code:
$varX = $this->input->post('param1', TRUE);
$varY = $this->input->post('param2', TRUE);
$varW = $this->functionA->getValue($varX);

**$varZ = $varW . $varY;          //line referenced in the error as the problem

$this->db->where('colX', $varX);
$this->db->where('colY', $varZ);
$query = $this->db->get('table1');

I'm sure there is a simple solution that I am missing here and after reading the:
..input->post
..forums
..CI user guide
..php concatenation, etc...

I still haven't found the answer and I'm sure it has something to do with the variable reference or retrieval.

I'm new to CI, thanks for the help.
#2

[eluser]pistolPete[/eluser]
Please use code tags!

Since you didn't post functionA, I have to guess it's returning a database result object, which you just can't concatenate with a string to another string.
#3

[eluser]Unknown[/eluser]
That is correct, the object returned from FUNCTION A is a database object. Based on your assessment, I made the changes below "Revised Code" and no longer getting the 4096. Thanks.

FUNCTION A
Code:
$this->db->select('columnF');
$this->db->where('varX', $varX);
$query = $this->db->get('table2');

if($query) {
  return $query;
}else{
  return FALSE;
}

REVISED CODE:
Code:
$varX = $this->input->post('param1', TRUE);
$varY = $this->input->post('param2', TRUE);
$varW = $this->functionA->getValue($varX);

**$varZ = $varW->row('colW') . $varY;          //CHANGED

$this->db->where('colX', $varX);
$this->db->where('colY', $varZ);
$query = $this->db->get('table1');




Theme © iAndrew 2016 - Forum software by © MyBB