I am trying to convert the data that I selected from mysql database to json format. I am using Joomla 3.2.1 so that I can use it for my iOS application.
I am getting syntax error unexpected Jresponse t_string error near JResponse.
I would appreciate if anyone can point me in the right direction. thank you.
<?php
defined ('_JEXEC') or die('');
require_once JPATH_SITE.'/components/com_content/helpers/route.php';
jimport('joomla.application.component.controller');
jimport('joomla.appliction.component.model');
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('order_id', 'store_name', 'invoice', 'firstname')));
$query->from($db->quoteName('#__mynicetable'));
$query->where($db->quoteName('order_id') );
$query->order('order_id ASC');
$db->setQuery($query);
$row=$db->loadRowList();
print_r($row);
$data =array ($row);
$document= JFactory::getDocument;
$document-> setMimetEncoding('application/json')
JResponse::setHeader('Content-Disposition', 'attachment;filename="'.$view- >getName().'.json"');
echo json_encode($data);