PHP Codeigniter error: call to undefined method ci_db_mysql_driver::result()

Posted by Ronnie on Stack Overflow See other posts from Stack Overflow or by Ronnie
Published on 2011-11-22T09:37:55Z Indexed on 2011/11/22 9:51 UTC
Read the original article Hit count: 1925

Filed under:
|
|

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>';
    }
}
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml