PHP Codeigniter error: call to undefined method ci_db_mysql_driver::result()
- by Ronnie
I was trying to create an xml response using codeigniter. The following error gets thrown when i run the code.
This page contains the following errors:
error on line 1 at column 48: Extra content at the end of the document
<?php
class Api extends CI_Controller{
function index()
{
$this->load->helper('url', 'xml', 'security');
echo '<em>oops! no parameters selected.</em>';
}
function authorize($email = 'blank', $password = 'blank')
{
header ("content-type: text/xml");
echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
echo '<node>';
if ($email == 'blank' AND $password == 'blank')
{
echo '<response>failed</response>';
}
else
{
$this->db->where('email_id', $email);
$this->db->limit(1);
$query = $this->db->from('lp_user_master');
$this->get();
$count = $this->db->count_all_results();
if ($count > 0)
{
foreach ($query->result() as $row){
echo '<ip>'.$row->title.'</ip>';
}
}
}
echo '</node>';
}
}
?>