<?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: doesn't show any record</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record</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/doesnt-show-any-record/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>turkitopy on doesn't show any record</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18419</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18419</guid>
        	        	<description><![CDATA[<pre><p><input type='button' class='sfcodeselect' name='sfselectit4976' value='Select Code' data-codeid='sfcode4976' /></p><div class='sfcode' id='sfcode4976'>&#60;?php <br />include(&#39;connections/dbconfig.php&#39;);<br /><br />$page = $_GET[&#39;page&#39;]; // get the requested page<br />$limit = $_GET[&#39;rows&#39;]; // get how many rows we want to have into the grid<br />$sidx = $_GET[&#39;sidx&#39;]; // get index row - i.e. user click to sort<br />$sord = $_GET[&#39;sord&#39;]; // get the direction<br />if(!$sidx) $sidx =1;<br />// connect to the database<br />$db = mysql_connect($dbhost, $dbuser, $dbpassword)<br />or die(&#34;Connection Error: &#34; . mysql_error());<br /><br />mysql_select_db($database) or die(&#34;Error conecting to db.&#34;);<br />$result = mysql_query(&#34;SELECT COUNT(*) AS count FROM invheader a, clients b WHERE a.client_id=b.client_id&#34;);<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];<br /><br />if( $count &#38;gt;0 ) {<br /> $total_pages = ceil($count/$limit);<br />} else {<br /> $total_pages = 0;<br />}<br />if ($page &#38;gt; $total_pages) $page=$total_pages;<br />$start = $limit*$page - $limit; // do not put $limit*($page - 1)<br />$SQL = &#34;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&#34;;<br />$result = mysql_query( $SQL ) or die(&#34;Couldn t execute query.&#34;.mysql_error());<br /><br />$responce-&#38;gt;page = $page;<br />$responce-&#38;gt;total = $total_pages;<br />$responce-&#38;gt;records = $count;<br />$i=0;<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br /> $responce-&#38;gt;rows[$i][&#39;id&#39;]=$row[id];<br /> $responce-&#38;gt;rows[$i][&#39;cell&#39;]=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]);<br /> $i++;<br />}        <br />echo json_encode($responce);<br /><br />?&#62;</div></pre>
]]></description>
        	        	<pubDate>Tue, 06 Jul 2010 15:52:05 +0300</pubDate>
        </item>
        <item>
        	<title>turkitopy on doesn't show any record</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18399</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18399</guid>
        	        	<description><![CDATA[<p>yes i have... this is the html:</p>
<p>...</p>
<p>&#60;head&#62;</p>
<p>&#60;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&#62;</p>
<p>&#60;title&#62;My First Grid&#60;/title&#62;</p>
</p>
<p>&#60;link rel="stylesheet" type="text/css" media="screen" href="css/ui-lightness/jquery-ui-1.8.2.custom.css" /&#62;</p>
<p>&#60;link rel="stylesheet" type="text/css" media="screen" href="js/src/css/ui.jqgrid.css" /&#62;</p>
<p>&#60;link rel="stylesheet" type="text/css" media="screen" href="js/src/css/jquery.searchFilter.css" /&#62;</p>
</p>
<p>&#60;style&#62;</p>
<p>html, body {</p>
<p>margin: 0;</p>
<p>padding: 0;</p>
<p>font-size: 75%;</p>
<p>}</p>
<p>&#60;/style&#62;</p>
<p>&#60;script src="js/jquery-1.4.2.min.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;script src="js/src/grid.loader.js" type="text/javascript"&#62;&#60;/script&#62;</p>
</p>
<p>&#60;script type="text/javascript"&#62;</p>
<p>jQuery(document).ready(function(){</p>
<p>jQuery("#list").jqGrid({</p>
<p>url:&#39;example.php&#39;,</p>
<p>datatype: &#39;xml&#39;,</p>
<p>mtype: &#39;GET&#39;,</p>
<p>colNames:[&#39;Inv No&#39;,&#39;Date&#39;, &#39;Amount&#39;,&#39;Tax&#39;,&#39;Total&#39;,&#39;Notes&#39;],</p>
<p>colModel :[</p>
<p>{name:&#39;invid&#39;, index:&#39;invid&#39;, width:55},</p>
<p>{name:&#39;invdate&#39;, index:&#39;invdate&#39;, width:90},</p>
<p>{name:&#39;amount&#39;, index:&#39;amount&#39;, width:80, align:&#39;right&#39;},</p>
<p>{name:&#39;tax&#39;, index:&#39;tax&#39;, width:100, align:&#39;right&#39;},</p>
<p>{name:&#39;total&#39;, index:&#39;total&#39;, width:100, align:&#39;right&#39;},</p>
<p>{name:&#39;note&#39;, index:&#39;note&#39;, width:150, sortable:false}</p>
<p>],</p>
<p>pager: &#39;#pager&#39;,</p>
<p>rowNum:10,</p>
<p>rowList:[10,20,30],</p>
<p>sortname: &#39;invid&#39;,</p>
<p>sortorder: &#39;desc&#39;,</p>
<p>viewrecords: true,</p>
<p>caption: &#39;My first grid&#39;</p>
<p>});</p>
<p>});</p>
<p>&#60;/script&#62;</p>
</p>
<p>&#60;/head&#62;</p>
<p>&#60;body&#62;</p>
<p>&#60;table id="list"&#62;&#60;/table&#62;</p>
<p>&#60;div id="pager"&#62;&#60;/div&#62;</p>
</p>
<p>&#60;/body&#62;</p>
<p>...</p>
]]></description>
        	        	<pubDate>Mon, 05 Jul 2010 22:48:36 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on doesn't show any record</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18395</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18395</guid>
        	        	<description><![CDATA[<p>Hi!</p>
<p>You posted only a part from /jqgridwiki/doku.php?id=wiki:first_grid&#160;which correspond to the&#160;<span style="font-size: 13.8889px; white-space: pre;">example.php. This part will be called from another part: HTML page with a JavaScript inside which contain</span></p>
<p><span style="font-size: 13.8889px; white-space: pre;">jQuery("#list").jqGrid({<br /><span style="font-size: 13.8889px;"> url:&#39;example.php&#39;,<br /><span style="font-size: 13.8889px;"> // ...</span></span></span></p>
<p><span style="white-space: pre;">Do you have created the corresponding HTML pag?</span></p>
<p><span style="white-space: pre;">Regards<br />Oleg</span></p>
]]></description>
        	        	<pubDate>Mon, 05 Jul 2010 19:15:21 +0300</pubDate>
        </item>
        <item>
        	<title>turkitopy on doesn't show any record</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18388</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/doesnt-show-any-record#p18388</guid>
        	        	<description><![CDATA[<p>Hello, im just starting using jQuery plugin, and i think im starting with the wrong foot&#160; =S</p>
</p>
<p>I have done the example from the wiki page, using jQGrid, and I&#39;ve done everything it says i have to do, but no record is shown on the grid ones i execute the code.</p>
<p>Im using jqgrid 1.4.2 en the code of the PHP (where i thing the problem is):</p>
</p>
<p>&#60;?php</p>
<p>//include the information needed for the connection to MySQL data base server.</p>
<p>// we store here username, database and password</p>
<p>include("connections/dbconfig.php");</p>
</p>
<p>// to the url parameter are added 4 parameters as described in colModel</p>
<p>// we should get these parameters to construct the needed query</p>
<p>// Since we specify in the options of the grid that we will use a GET method</p>
<p>// we should use the appropriate command to obtain the parameters.</p>
<p>// In our case this is $_GET. If we specify that we want to use post</p>
<p>// we should use $_POST. Maybe the better way is to use $_REQUEST, which</p>
<p>// contain both the GET and POST variables. For more information refer to php documentation.</p>
<p>// Get the requested page. By default grid sets this to 1.</p>
<p>$page = $_GET[&#39;page&#39;];</p>
</p>
<p>// get how many rows we want to have into the grid - rowNum parameter in the grid</p>
<p>$limit = $_GET[&#39;rows&#39;];</p>
</p>
<p>// get index row - i.e. user click to sort. At first time sortname parameter -</p>
<p>// after that the index from colModel</p>
<p>$sidx = $_GET[&#39;sidx&#39;];</p>
</p>
<p>// sorting order - at first time sortorder</p>
<p>$sord = $_GET[&#39;sord&#39;];</p>
</p>
<p>// if we not pass at first time index use the first column for the index or what you want</p>
<p>if(!$sidx) $sidx =1;</p>
</p>
<p>// connect to the MySQL database server</p>
<p>$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());</p>
</p>
<p>// select the database</p>
<p>mysql_select_db($database) or die("Error connecting to db.");</p>
</p>
<p>// calculate the number of rows for the query. We need this for paging the result</p>
<p>$result = mysql_query("SELECT COUNT(*) AS count FROM invheader");</p>
<p>$row = mysql_fetch_array($result,MYSQL_ASSOC);</p>
<p>$count = $row[&#39;count&#39;];</p>
</p>
<p>// calculate the total pages for the query</p>
<p>if( $count &#62; 0 &#38;&#38; $limit &#62; 0) {</p>
<p>$total_pages = ceil($count/$limit);</p>
<p>} else {</p>
<p>$total_pages = 0;</p>
<p>}</p>
</p>
<p>// if for some reasons the requested page is greater than the total</p>
<p>// set the requested page to total page</p>
<p>if ($page &#62; $total_pages) $page=$total_pages;</p>
</p>
<p>// calculate the starting position of the rows</p>
<p>$start = $limit*$page - $limit;</p>
</p>
<p>// if for some reasons start position is negative set it to 0</p>
<p>// typical case is that the user type 0 for the requested page</p>
<p>if($start &#60;0) $start = 0;</p>
</p>
<p>// the actual query for the grid data</p>
<p>$SQL = "SELECT invid, invdate, amount, tax,total, note FROM invheader ORDER BY $sidx $sord LIMIT $start , $limit";</p>
<p>$result = mysql_query( $SQL ) or die("Couldn&#39;t execute query.".mysql_error());</p>
</p>
<p>// we should set the appropriate header information. Do not forget this.</p>
<p>header("Content-type: text/xml;charset=utf-8");</p>
</p>
<p>$s = "&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;";</p>
<p>$s .=  "&#60;rows&#62;";</p>
<p>$s .= "&#60;page&#62;".$page."&#60;/page&#62;";</p>
<p>$s .= "&#60;total&#62;".$total_pages."&#60;/total&#62;";</p>
<p>$s .= "&#60;records&#62;".$count."&#60;/records&#62;";</p>
</p>
<p>// be sure to put text data in CDATA</p>
<p>while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {</p>
<p>$s .= "&#60;row id=&#39;". $row[invid]."&#39;&#62;";</p>
<p>$s .= "&#60;cell&#62;". $row[invid]."&#60;/cell&#62;";</p>
<p>$s .= "&#60;cell&#62;". $row[invdate]."&#60;/cell&#62;";</p>
<p>$s .= "&#60;cell&#62;". $row[amount]."&#60;/cell&#62;";</p>
<p>$s .= "&#60;cell&#62;". $row[tax]."&#60;/cell&#62;";</p>
<p>$s .= "&#60;cell&#62;". $row[total]."&#60;/cell&#62;";</p>
<p>$s .= "&#60;cell&#62;&#60;![CDATA[". $row[note]."]]&#62;&#60;/cell&#62;";</p>
<p>$s .= "&#60;/row&#62;";</p>
<p>}</p>
<p>$s .= "&#60;/rows&#62;";</p>
</p>
<p>echo $s;</p>
<p>?&#62;</p>
</p>
<p>Thanks.</p>
]]></description>
        	        	<pubDate>Mon, 05 Jul 2010 04:48:36 +0300</pubDate>
        </item>
</channel>
</rss>