-1

Possible Duplicate:
XML creation using CodeIgniter

$this->output->set_content_type('text/xml');
echo $this->dbutil->xml_from_result($query, $config) 

From above code I can't see the data set in XML format. In my view page it shows the the data in the normal view as I saw it before.

1
  • I posted an edit to my answer on your other (same) question that should help you. Commented Apr 28, 2012 at 7:48

1 Answer 1

0

maybe you should try this

function user_get()
{
    if(!$this->get('id'))
    {
        $this->response(NULL, 400);
    }

        function users($id){

            $query = $this->db->get('student');
                    $this->db->where('EID', $id); 
            $config = array (
                              'root'    => 'users',
                              'element' => 'item',
                              'newline' => "\n",
                              'tab'    => "\t"
                            );
            $this->load->dbutil();
            echo '<?xml version="1.0" encoding="utf-8" ?> ';
            print $this->dbutil->xml_from_result($query, $config);
        } 

    $id = @$users[$this->get('id')];

    if($user)
    {
        $this->response($user, 200); // 200 being the HTTP response code
    }

    else
    {
        $this->response(array('error' => 'User could not be found'), 404);
    }

}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.