Forum


17:27

27/05/2010

When i execute this code i was only able to get the data out but is not entering the jqgrid table as i expect can anyone help me out by putting me throguh as sson as possible cos i need to delever the Job today.Thanks will be expecting reply.
class ML2 extends Controller{
var $gsm;
var $keyword = 'ml';
var $email_add;
var $firstname;
var $body;
var $per_page = 50;
function Ml2()
{
parent::Controller();
$this->load->model('Ml_model');
$this->load->model('sms_model_reseller');
//$this = get_instance();
$this->load->helper('url');
$this->load->library('session');
$this->config->item('base_url');
}
function index()
{
$data['title'] = 'ME & LECKY | TechClick Limited LongCode System';
$data['rows'] = $this->Ml_model->get_ml_data('per_page');
$data['content'] = $this->load->view('ml2_view', $data, TRUE);
$this->load->view('main', $data);
echo json_encode($data);
$page = $_GET['page']; // get the requested page
$limit = $_GET['rows']; // get how many rows we want to have into the grid
$sidx = $_GET['sidx']; // get index row - i.e. user click to sort
$sord = $_GET['sord']; // get the direction
if(!$sidx) $sidx =1; // connect to the database
$db = mysql_connect("localhost","root","")
or die("Connection Error: " . mysql_error());
mysql_select_db($database) or die("Error conecting to db.");
$result = $this->db->query("SELECT * AS numrow FROM ml");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$row = $result->row();
$count = $row->numrow;
$count = $row['count'];
if( $count >0 ) {
$total_pages = ceil($count/$limit);
}
else{
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
$result = $this->query("SELECT * FROM ml ORDER BY $numrow LIMIT $start $limit");
$sql = "SELECT id, gsm, email, firstname,body,date,time FROM ml,ORDER BY $sidx $sord LIMIT $start , $limit";
$data->page = $page;
$data->total = $total_pages;
$data->records = $count;
$i=0;
foreach ($result->result() as $nrow)
{//ID GSM EMAIL FIRSTNAME BODY DATE TIME
$data->nrow[$i]['id']=$nrow[id];
$data->nrow[$i]['cell']=array($nrow[id],$nrow[gsm],$nrow[email],$nrow[firstname],$nrow[body],$nrow[date_time]);
$i++;
}
echo json_encode($data);
}
}
Most Users Ever Online: 715
Currently Online:
60 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66