I spent 2 hours searching through the other few posts at Stack Overflow concerning this issue and they seemed more complicated than what I needed. I attempted doing the __toString function but I don't think I did it correctly.
I am trying to take the sql statement for $personid and convert it to a string so I can use it in the other sql methods.
$personid = $this->db->query('SELECT person_id FROM person');
$fullname = $this->db->query("SELECT person_fname, person_lname FROM person
WHERE person_id = '".$personid."';");
$sport = $this->db->query("SELECT sport_name FROM person_sport_rel A1
INNER JOIN sport A2 ON A1.sport_id = A2.sport_id
WHERE person_Id = '".$personid."';");
Just as the other posts had the problem.. the error I receive is
Object of class CI_DB_mysql_result could not be converted to string
I tried adding the constructor and the __toString in the CI_DB_mysql_result class that was recommended on the PHP site but to no avail