Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
jqGrid + ADODB5
08/03/2011
18:06
Avatar
alexrainman
New Member
Members
Forum Posts: 1
Member Since:
08/03/2011
sp_UserOfflineSmall Offline

I was trying this code to use adodb library for php. The grid doesnt show me anything.

Neither with XML or JSON.

Someone can tell me what i'm doing wrong?

<?php
include('adodb5/adodb.inc.php');
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$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 = ADONewConnection('mysql'); # eg 'mysql' or 'postgres'
$db->debug = true;
$db->Connect('localhost', 'root', 'admin', 'jQgrid_demos');
$row = $db->GetRow("SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id");
$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 = $db->Execute("SELECT a.id, a.invdate, b.name, a.amount,a.tax,a.total,a.note FROM invheader a, clients b WHERE a.client_id=b.client_id ORDER BY $sidx $sord LIMIT $start, $limit");
$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$i=0;
while ($row = $result->fetchRow()){
   $responce->rows[$i]['id']=$row[id];
   $responce->rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]);
   $i++;
}
echo json_encode($responce);
?>

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
64 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information