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
Help there is the same data loading on all page
29/05/2014
17:57
Avatar
tifischer
Member
Members
Forum Posts: 21
Member Since:
16/05/2014
sp_UserOfflineSmall Offline

I recently installed the 4.6.0 and I can see my data but the data is showing the same for all pages.  If I increase the number of rows when I load I see the data fro all those rows but when I go to the next page it is still the same data.  Please let me know how to correct the problem that the same data is displaying on all pages. 

server-update.php :

[code]

$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($dbhost, $dbuser, $dbpass) or die("Connection Error: " . mysql_error());
mysql_select_db($database) or die("Error conecting to db.");

$result = mysql_query("SELECT COUNT(*) AS count FROM persons a INNER JOIN addresses b ON b.personID=a.personID WHERE a.isActive=1 ");

$row = mysql_fetch_array($result,MYSQL_ASSOC);
$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)

$SQL = "SELECT * FROM persons a INNER JOIN addresses b ON b.personID=a.personID WHERE 1=1 AND a.isActive=1 ORDER BY $sidx $sord limit $limit";
$result = mysql_query( $SQL ) or die("Couldn t execute query. $SQL".mysql_error());

$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;

$rowCount=0;

while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {

...

if ($tmpPersonType==0) $personType = "Related";
if ($tmpPersonType==1) $personType = "Student";
if ($tmpPersonType==2) $personType = "Instructor";
if ($tmpPersonType==3) $personType = "Business";

$responce->rows[$rowCount]['id']=$row[personID];
$responce->rows[$rowCount]['cell']=array($row[personID],$personType,$row[firstName],$row[lastName],$row[emailAddress],$tmpPhone,$row[address],$tmpCustom,$tmpRegistrations,$newBalance);

$rowCount++;

...

}

echo json_encode($responce);

[code]

 

person_search-update.php:

[code]

<link rel="stylesheet" type="text/css" media="screen" href="jqgrid_420/themes/redmond/jquery-ui-custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid_420/themes/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid_420/themes/ui.multiselect.css" />
<style type="text">
html, body {
margin: 0; /* Remove body margin/padding */
padding: 0;
overflow: hidden; /* Remove scroll bars on browser window */
font-size: 75%;
}
</style>
<script src="jqgrid_420/js/jquery.js" type="text/javascript"></script>
<script src="jqgrid_420/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script src="jqgrid_420/js/jquery.jqGrid.js" type="text/javascript"></script>
<script src="jqgrid_420/js/grid.pivot.js" type="text/javascript"></script>
<script src="jqgrid_420/js/jquery-ui-custom.min.js" type="text/javascript"></script>

<script type="text/javascript">
jQuery(document).ready(function(){

var template1 = { "groupOp": "AND", "rules": [ { "field": "a.firstName", "op": "bw", "data": "Client 1" },
{ "field": "a.lastName", "op": "gt", "data": "20"} ] };

jQuery("#person_list").jqGrid({
url:'server-update.php?q=2',
datatype: "json",
colNames:['ID','Type','Last','First','Email','Phone','Address','Custom','Registrations','Balance'],
colModel:[
{name:'id',index:'a.personID', width:20},
{name:'Type', index:'isStudent', sortable:true, width:25},
{name:'Last', index:'a.lastName', width:40},
{name:'First', index:'a.firstName', width:30},
{name:'Email', sortable:true, index:'a.emailAddress', width:60,searchoptions:{sopt:['bw','cn','eq','ne','lt','gt','ew']}},
{name:'Phone', sortable:false,index:'phone', width:35},
{name:'Address', sortable:false,index:'address', width:100},
{name:'Custom', sortable:false,search:false, hidden:false, index:'custom', width:30},
{name:'Registrations', sortable:false,search:false, hidden:false, index:'programCode', width:100},
{name:'Balance', sortable:false,search:false, hidden:false,align:"right", index:'balance', width:40} //CN change 30 to 40
],
rowNum:10,
width:700,
height: '100%',
pager: '#pagerb',
sortname: 'lastName',
rowList:[10,20,50],
viewrecords: true,
sortorder: "asc",
caption: "",

});

jQuery("#person_list").jqGrid('navGrid','#pagerb', {
edit:false,
add:false,
del:false},
{}, {}, {},
{ multipleSearch:true, multipleGroup:false, showQuery: false,
// set the names of the template
"tmplNames" : ["Template One"],
// set the template contents
"tmplFilters": [template1] } );

});

</script>

[/code]

Also how can I get your forum to not dump the formatting when I past my code and save?

 

Blessings,

Tiffany

30/05/2014
18:14
Avatar
tifischer
Member
Members
Forum Posts: 21
Member Since:
16/05/2014
sp_UserOfflineSmall Offline

I noticed that I get different results if I use response or responce.  I noticed that there is some discontinuity in the source code when I searched for response and responce I found results for both.  I attempted to change all to one or the other but neither work.  With responce I get many pages but all the same results on each page.  With response I get only one page with results.  Please advise as to how to solve this problem. 

 

Blessings,

Tiffany

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
50 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