<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Search Data..</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/search-data</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/search-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>aznan on Search Data..</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/search-data#p16053</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/search-data#p16053</guid>
        	        	<description><![CDATA[<p>hehe.. i&#39;ve solved my problem.. just follow the sample..</p>
<p>some typo in the example 3=&#62;4 and I forgot the last pt of the sample..</p>
<p>thnx tony 4 this amazing stuff.</p>
]]></description>
        	        	<pubDate>Wed, 31 Mar 2010 05:35:37 +0300</pubDate>
        </item>
        <item>
        	<title>aznan on Search Data..</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/search-data#p15947</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/search-data#p15947</guid>
        	        	<description><![CDATA[<p>can anyone show me how to implement search in my jqgrid&#8230;</p>
<p>everything works find in my grid.. but i dunno how to construct searchh&#8230;i&#39;ve try to follow the example .. [but most part i dont really understand] helpp.. please.. what/where should i amend&#8230;</p>
<p>below is my code [ap_id is the id for each claim being made &#38; action is to set either new @ edit ]:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6437' value='Select Code' data-codeid='sfcode6437' /></p>
<div class='sfcode' id='sfcode6437'>var lastSel;<br />&#160; var ap_id = $(&#34;#no&#34;).val();<br />&#160; var action = $(&#34;#action&#34;).val();</p>
<p>jQuery(&#34;#claim&#34;).jqGrid({<br />&#160; url:&#39;form/claim_data.php?apid=&#39;+ap_id,<br />&#160; datatype: &#34;json&#34;,<br />&#160; colNames:[&#39;Claim Detail ID&#39;,&#39;Item&#39;,&#39;Claim ID&#39;, &#39;Date&#39;, &#39;Reference&#39;, &#39;Amount&#39;,&#160; &#39;Site ID&#39;,&#39;Acc ID&#39;],&#160;&#160; &#160; <br />&#160; colModel:[<br />&#160;&#160; &#160;&#160; {name:&#39;int_claimdetailid&#39;,index:&#39;int_claimdetailid&#39;, editable:true, align:&#34;center&#34;, width:110, hidden:true },<br />&#160;&#160; &#160;&#160; {name:&#39;txt_item&#39;, index:&#39;txt_item&#39;, editable:true,&#160; align:&#34;center&#34;, width:150, stype:&#39;text&#39; },<br />&#160;&#160; &#160;&#160; {name:&#39;int_claimid&#39;,index:&#39;int_claimid asc, txt_item&#39;, editable:true, align:&#34;center&#34;, width:50},<br />&#160;&#160; &#160;&#160; {name:&#39;dt_date&#39;,index:&#39;dt_date&#39;, width:80, align:&#34;center&#34;, editable:true, sorttype:&#34;date&#34;},<br />&#160;&#160; &#160;&#160; {name:&#39;int_reference&#39;,index:&#39;int_reference&#39;, width:60, align:&#34;center&#34;, editable:true, editoptions:{size:&#34;20&#34;,maxlength:&#34;30&#34;}},<br />&#160;&#160; &#160;&#160; {name:&#39;cur_amount&#39;,index:&#39;cur_amount&#39;, width:110, align:&#34;right&#34;,editable:true, formatter:&#39;currency&#39;, formatoptions:{decimalSeparator:&#34;.&#34;, thousandsSeparator: &#34;,&#34;, decimalPlaces: 2, prefix: &#34;RM &#34;, suffix: &#34;&#160; &#34;}},<br />&#160;&#160; &#160;&#160; {name:&#39;int_siteid&#39;,index:&#39;int_siteid&#39;, width:100, align:&#34;center&#34;, editable:true, edittype:&#34;select&#34;, editoptions:{dataUrl:&#39;form/populating.php&#39;}},<br />&#160;&#160; &#160;&#160; {name:&#39;int_accid&#39;,index:&#39;int_accid&#39;, width:50, align:&#34;center&#34;, editable:true, sortable:false }&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160; ],</p>
<p>&#160; pager: &#39;#pagerclaim&#39;,&#160; <br />&#160; rowNum:10,<br />&#160; rowList:[10,20,30],<br />&#160; height:&#39;auto&#39;,<br />&#160; sortname: &#39;int_claimdetailid&#39;,<br />&#160; /*scrollOffset:0,*/ //scrollarea<br />&#160; hidegrid: false,&#160;&#160; <br />&#160; sortorder: &#39;desc&#39;,<br />&#160; viewrecords: true, //display the number of total records<br />&#160; editurl:&#34;form/claim_edit.php?mode=edit&#34;,<br />&#160; loadtext: &#34;tgh load tuk, jap lok&#8230;&#34;,<br />&#160; rownumbers:true, // add row numbers on left side<br />&#160; caption: &#39;&#160;&#160; Claim Detail&#39;,<br />&#160; <br />&#160;ondblClickRow: function(id){<br />&#160;&#160; &#160; if(id &#38;&#38; id!==lastSel){ <br />&#160;&#160; &#160;&#160;&#160; jQuery(&#39;#claim&#39;).restoreRow(lastSel); <br />&#160;&#160; &#160;&#160;&#160; lastSel=id; <br />&#160;&#160; &#160;} <br />&#160;&#160; &#160;jQuery(&#39;#claim&#39;).editRow(id, true); <br />&#160;}<br />&#160;<br />}); /* end of jqgrid */</p>
<p>if (action == &#34;new&#34; &#124;&#124; action == &#34;edit&#34; ) {<br />&#160;&#160; &#160; &#160;<br />&#160;&#160; &#160;jQuery(&#34;#claim&#34;).jqGrid(&#39;navGrid&#39;,&#39;#pagerclaim&#39;,{edit:false, add:false, view:false, del:true, search:false}, <br />&#160;&#160; &#160;&#160; {}, // use default settings for edit<br />&#160;&#160; &#160;&#160; {}, // use default settings for add<br />&#160;&#160; &#160;&#160; {url: &#39;form/claim_edit.php?mode=delete&#39;},&#160; // delete instead that del:false we need this<br />&#160;&#160; &#160;&#160; /*{multipleSearch : true}, // enable the advanced searching*/<br />&#160;&#160; &#160;&#160; {closeOnEscape:true} <br />&#160;&#160; &#160;&#160; );&#160; //end on navgrid<br />&#160;&#160; }</p>
<p>function pickdates(id){ /* datepicker */<br />&#160;&#160;&#160; &#160;jQuery(&#34;#&#34;+id+&#34;_dt_date&#34;,&#34;#claim&#34;).datepicker({dateFormat:&#34;yy-mm-dd&#34;}); }</p>
</div>
<p>below is my original data file (working ok):</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3517' value='Select Code' data-codeid='sfcode3517' /></p>
<div class='sfcode' id='sfcode3517'>
<p>include(&#39;../Connections/mycon.php&#39;);<br />include(&#34;../includes/JSON.php&#34;);<br />$json = new Services_JSON();<br />$apid=$_REQUEST[&#39;apid&#39;]; <br />$page = $_REQUEST[&#39;page&#39;];<br />$limit = $_REQUEST[&#39;rows&#39;];<br />$sidx = $_REQUEST[&#39;sidx&#39;];<br />$sord = $_REQUEST[&#39;sord&#39;];</p>
<p>if(!$sidx) $sidx =1;</p>
<p>$db = mysql_connect($hostname_mycon, $username_mycon, $password_mycon)<br />or die(&#34;Connection Error: &#34; . mysql_error());<br />&#160;<br />mysql_select_db($database_mycon) or die(&#34;Error conecting to db.&#34;);<br />&#160;<br />$result = mysql_query(&#34;SELECT COUNT(int_claimdetailid) AS count FROM tbl_claimdetail WHERE int_claimid=&#34;.$apid.&#34;&#34;);<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];</p>
<p>if( $count &#62;0 ) {<br />&#160;&#160; &#160;$total_pages = ceil($count/$limit);<br />} else {<br />&#160;&#160; &#160;$total_pages = 0;<br />}</p>
<p>if ($page &#62; $total_pages) $page=$total_pages;</p>
<p>$start = $limit*$page &#8211; $limit; // do not put $limit*($page &#8211; 1)<br />&#160;<br />if($start &#60;0) $start = 0;</p>
<p>// the actual query for the grid data<br />$SQL = &#34;SELECT int_claimdetailid, txt_item, int_claimid, dt_date, int_reference, cur_amount, int_siteid, int_accid FROM tbl_claimdetail WHERE int_claimid=&#34;.$apid.&#34; ORDER BY $sidx $sord LIMIT $start, $limit&#34;;<br />$result = mysql_query( $SQL ) or die(&#34;Couldn t execute query.&#34;.mysql_error());</p>
<p>// query for GRAND total<br />$squely = &#34;SELECT int_claimdetailid, txt_item, int_claimid, dt_date, int_reference, cur_amount, int_siteid, int_accid FROM tbl_claimdetail&#160; WHERE int_claimid=&#34;.$apid.&#34;&#34;;<br />$resulto = mysql_query( $squely ) or die(&#34;Couldn t execute query.&#34;.mysql_error());</p>
<p>$responce-&#62;page = $page;<br />$responce-&#62;total = $total_pages;<br />$responce-&#62;records = $count;<br />$i=0;</p>
<p>while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;id&#39;]=$row[int_claimdetailid];<br />&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;cell&#39;]=array($row[int_claimdetailid],$row[txt_item],$row[int_claimid],$row[dt_date],$row[int_reference],$row[cur_amount],$row[int_siteid],$row[int_accid]);<br />&#160;&#160;&#160; $i++;<br />}</p>
<p>$amttot =0;<br />while($rowto = mysql_fetch_array($resulto,MYSQL_ASSOC)) {<br />&#160;&#160; &#160;$amttot += $rowto[cur_amount];<br />}</p>
<p>$responce-&#62;userdata[&#39;cur_amount&#39;] = $amttot; <br />$responce-&#62;userdata[&#39;int_reference&#39;] = &#39;Totals:&#39;; <br />&#160;<br />echo $json-&#62;encode($responce);</p>
</div>
<p>i try to change it to this .. something like the examples.. but some of the content i cant understand ..e.g. $wh&#8230;</p>
<p>but it seems not working&#8230; hlppp pleaseeee&#8230;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit432' value='Select Code' data-codeid='sfcode432' /></p>
<div class='sfcode' id='sfcode432'>&#60;?php<br />include(&#39;../Connections/mycon.php&#39;);<br />include(&#34;../includes/JSON.php&#34;);<br />$json = new Services_JSON();<br />&#160;$apid=$_REQUEST[&#39;apid&#39;]; <br />$page = $_REQUEST[&#39;page&#39;];<br />$limit = $_REQUEST[&#39;rows&#39;];<br />$sidx = $_REQUEST[&#39;sidx&#39;];<br />$sord = $_REQUEST[&#39;sord&#39;]; </p>
<p>if(!$sidx) $sidx =1;</p>
<p>$wh = &#34;&#34;;<br />$searchOn = Strip($_REQUEST[&#39;_search&#39;]);<br />if($searchOn==&#39;true&#39;) {<br />&#160;&#160; &#160;$searchstr = Strip($_REQUEST[&#39;filters&#39;]);<br />&#160;&#160; &#160;$wh= constructWhere($searchstr);<br />&#160;&#160; &#160;//echo $wh;<br />}<br />function constructWhere($s){<br />&#160;&#160;&#160; $qwery = &#34;&#34;;<br />&#160;&#160; &#160;//[&#39;eq&#39;,&#39;ne&#39;,&#39;lt&#39;,&#39;le&#39;,&#39;gt&#39;,&#39;ge&#39;,&#39;bw&#39;,&#39;bn&#39;,&#39;in&#39;,&#39;ni&#39;,&#39;ew&#39;,&#39;en&#39;,&#39;cn&#39;,&#39;nc&#39;]<br />&#160;&#160;&#160; $qopers = array(<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;eq&#39;=&#62;&#34; = &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;ne&#39;=&#62;&#34; &#60;&#62; &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;lt&#39;=&#62;&#34; &#60; &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;le&#39;=&#62;&#34; &#60;= &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;gt&#39;=&#62;&#34; &#62; &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;ge&#39;=&#62;&#34; &#62;= &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;bw&#39;=&#62;&#34; LIKE &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;bn&#39;=&#62;&#34; NOT LIKE &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;in&#39;=&#62;&#34; IN &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;ni&#39;=&#62;&#34; NOT IN &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;ew&#39;=&#62;&#34; LIKE &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;en&#39;=&#62;&#34; NOT LIKE &#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;cn&#39;=&#62;&#34; LIKE &#34; ,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#39;nc&#39;=&#62;&#34; NOT LIKE &#34; );<br />&#160;&#160;&#160; if ($s) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $jsona = json_decode($s,true);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(is_array($jsona)){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$gopr = $jsona[&#39;groupOp&#39;];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$rules = $jsona[&#39;rules&#39;];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $i =0;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; foreach($rules as $key=&#62;$val) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $field = $val[&#39;field&#39;];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $op = $val[&#39;op&#39;];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $v = $val[&#39;data&#39;];<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if($v &#38;&#38; $op) {<br />&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $i++;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;// ToSql in this case is absolutley needed<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$v = ToSql($field,$op,$v);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if ($i == 1) $qwery = &#34; AND &#34;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;else $qwery .= &#34; &#34; .$gopr.&#34; &#34;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;switch ($op) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;// in need other thing<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; case &#39;in&#39; :<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; case &#39;ni&#39; :<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $qwery .= $field.$qopers[$op].&#34; (&#34;.$v.&#34;)&#34;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;default:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $qwery .= $field.$qopers[$op].$v;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; return $qwery;<br />}<br />function ToSql ($field, $oper, $val) {<br />&#160;&#160; &#160;// we need here more advanced checking using the type of the field &#8211; i.e. integer, string, float<br />&#160;&#160; &#160;switch ($field) {<br />&#160;&#160; &#160;&#160;&#160; &#160;case &#39;int_claimdetailid&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;case &#39;int_claimid&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return intval($val);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;break;<br />&#160;&#160; &#160;&#160;&#160; &#160;case &#39;cur_amount&#39;:</p>
<p>&#160;&#160; &#160;&#160;&#160; &#160;case &#39;total&#39;:<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return floatval($val);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;break;<br />&#160;&#160; &#160;&#160;&#160; &#160;default :<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;//mysql_real_escape_string is better<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if($oper==&#39;bw&#39; &#124;&#124; $oper==&#39;bn&#39;) return &#34;&#39;&#34; . addslashes($val) . &#34;%&#39;&#34;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;else if ($oper==&#39;ew&#39; &#124;&#124; $oper==&#39;en&#39;) return &#34;&#39;%&#34; . addcslashes($val) . &#34;&#39;&#34;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;else if ($oper==&#39;cn&#39; &#124;&#124; $oper==&#39;nc&#39;) return &#34;&#39;%&#34; . addslashes($val) . &#34;%&#39;&#34;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;else return &#34;&#39;&#34; . addslashes($val) . &#34;&#39;&#34;;<br />&#160;&#160; &#160;}<br />} </p>
<p>// connect to the MySQL database server<br />$db = mysql_connect($hostname_mycon, $username_mycon, $password_mycon)<br />or die(&#34;Connection Error: &#34; . mysql_error());</p>
<p>// select the database<br />mysql_select_db($database_mycon) or die(&#34;Error conecting to db.&#34;);</p>
<p>// calculate the number of rows for the query. We need this to paging the result<br />$result = mysql_query(&#34;SELECT COUNT(int_claimdetailid) AS count</p>
</div>
<p><input type='button' class='sfcodeselect' name='sfselectit1597' value='Select Code' data-codeid='sfcode1597' /></p>
<div class='sfcode' id='sfcode1597'>FROM tbl_claimdetail WHERE int_claimid=&#34;.$apid.&#34;&#34;.$wh.&#34;&#34;);<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];</p>
<p>// calculation of total pages for the query<br />if( $count &#62;0 ) {<br />&#160;&#160; &#160;$total_pages = ceil($count/$limit);<br />} else {<br />&#160;&#160; &#160;$total_pages = 0;<br />}</p>
<p>// if for some reasons the requested page is greater than the total<br />// set the requested page to total page<br />if ($page &#62; $total_pages) $page=$total_pages;</p>
<p>// calculate the starting position of the rows<br />$start = $limit*$page &#8211; $limit; // do not put $limit*($page &#8211; 1)<br />// if for some reasons start position is negative set it to 0<br />// typical case is that the user type 0 for the requested page<br />if($start &#60;0) $start = 0;</p>
<p>// the actual query for the grid data<br />$SQL = &#34;SELECT int_claimdetailid, txt_item, int_claimid, dt_date, int_reference, cur_amount, int_siteid, int_accid FROM tbl_claimdetail WHERE int_claimid=&#34;.$apid.&#34;&#34;.$wh.&#34; ORDER BY &#34;.$sidx.&#34; &#34;.$sord. &#34; LIMIT &#34;.$start.&#34; , &#34;.$limit;<br />$result = mysql_query( $SQL ) or die(&#34;Couldn t execute query.&#34;.mysql_error());</p>
<p>// query for GRAND total<br />$squely = &#34;SELECT int_claimdetailid, txt_item, int_claimid, dt_date, int_reference, cur_amount, int_siteid, int_accid FROM tbl_claimdetail&#160; WHERE int_claimid=&#34;.$apid.&#34;&#34;.$wh.&#34;&#34;;<br />$resulto = mysql_query( $squely ) or die(&#34;Couldn t execute query.&#34;.mysql_error());</p>
<p>$responce-&#62;page = $page;<br />$responce-&#62;total = $total_pages;<br />$responce-&#62;records = $count;<br />$i=0;</p>
<p>while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;id&#39;]=$row[int_claimdetailid];<br />&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;cell&#39;]=array($row[int_claimdetailid],$row[txt_item],$row[int_claimid],$row[dt_date],$row[int_reference],$row[cur_amount],$row[int_siteid],$row[int_accid]);<br />&#160;&#160;&#160; $i++;<br />}</p>
<p>$amttot =0;<br />while($rowto = mysql_fetch_array($resulto,MYSQL_ASSOC)) {<br />&#160;&#160; &#160;$amttot += $rowto[cur_amount];<br />}</p>
<p>$responce-&#62;userdata[&#39;cur_amount&#39;] = $amttot; <br />$responce-&#62;userdata[&#39;int_reference&#39;] = &#39;Totals:&#39;; </p>
<p>// return the formated data<br />echo $json-&#62;encode($responce);</p>
<p>?&#62;</p>
</div>
<p>&#160;&#160;&#160; <br />&#160;</p>
<p>&#160; <br />&#160;</p>
]]></description>
        	        	<pubDate>Thu, 25 Mar 2010 11:20:29 +0200</pubDate>
        </item>
</channel>
</rss>