<?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: jqgrid example problems</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-example-problems</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/jqgrid-example-problems/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on jqgrid example problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-example-problems#p10368</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-example-problems#p10368</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>In the example I got error&#160; - JQuery is not defined. See installatin instructions.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 03 Oct 2009 03:32:43 +0300</pubDate>
        </item>
        <item>
        	<title>thesheff17 on jqgrid example problems</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-example-problems#p10297</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-example-problems#p10297</guid>
        	        	<description><![CDATA[</p>
<p>I need some help getting the example working.&#160; I&#39;m pretty much have exactly what is on the examples page:</p>
<p>I get a grid with no data:</p>
<p><a rel="nofollow" href="http://99.69.43.34/test/test.html" target="_blank">http://99.69.43.34/test/test.html</a></p>
<p>I know Mysql Apache PHP are working together here:</p>
<p><a rel="nofollow" href="http://99.69.43.34/index.php" target="_blank">http://99.69.43.34/index.php</a></p>
<p>How do you know if the javascript is actually calling the php file correctly?&#160;</p>
<p>Any help would be greatly appreciated.</p>
</p>
<p>****update***</p>
</p>
<p>I had some things wrong in the PHP file.&#160; It looks like everything is working because I print out the SQL statement and it runs fine in the query browser.&#160; As soon as I commet out the echo statement for the SQL and run the PHP script again it prompts me to download the PHP file.&#160; I don&#39;t understand why this is happening?</p>
<p>can someone post their entire PHP file for example.&#160; I think it has to do with the header stuff but not 100%.</p>
</p>
<p>***old stuff ****</p>
<p>I have created a database called email and basically have the exact data that the example has:</p>
<p>mysql&#62; describe items;<br />+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />&#124; Field &#124; Type&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124; Null &#124; Key &#124; Default &#124; Extra&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124;<br />+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />&#124; index &#124; int(11)&#160;&#160;&#160;&#160; &#124; NO&#160;&#160; &#124; PRI &#124; NULL&#160;&#160;&#160; &#124; auto_increment &#124; <br />&#124; name&#160; &#124; varchar(50) &#124; NO&#160;&#160; &#124;&#160;&#160;&#160;&#160; &#124; NULL&#160;&#160;&#160; &#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124; <br />&#124; code&#160; &#124; int(11)&#160;&#160;&#160;&#160; &#124; NO&#160;&#160; &#124;&#160;&#160;&#160;&#160; &#124; NULL&#160;&#160;&#160; &#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124; <br />+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />3 rows in set (0.00 sec)</p>
</p>
<p>mysql&#62; select * from items;<br />+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+<br />&#124; index &#124; name&#160;&#160;&#160;&#160;&#160; &#124; code &#124;<br />+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+<br />&#124;&#160;&#160;&#160; 18 &#124; dsheffner &#124;&#160;&#160;&#160; 1 &#124; <br />&#124;&#160;&#160;&#160; 19 &#124; dsheffner &#124;&#160;&#160;&#160; 2 &#124; <br />&#124;&#160;&#160;&#160; 20 &#124; dsheffner &#124;&#160;&#160;&#160; 3 &#124; <br />&#124;&#160;&#160;&#160; 21 &#124; dsheffner &#124;&#160;&#160;&#160; 4 &#124; <br />&#124;&#160;&#160;&#160; 22 &#124; dsheffner &#124;&#160;&#160;&#160; 5 &#124; <br />+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+<br />5 rows in set (0.00 sec)</p>
</p>
<p>Here is my PHP:</p>
<p>&#60;?php<br />ini_set(&#39;max_execution_time&#39;, 600);<br />#include(&#8221;dbconfig.php&#8221;);<br />// coment the above lines if php 5<br />include(&#8221;JSON.php&#8221;);<br />$json = new Services_JSON();<br />// end comment<br />$examp = $_GET["q"]; //query number</p>
<p>$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 &#8211; i.e. user click to sort<br />$sord = $_GET[&#39;sord&#39;]; // get the direction<br />if(!$sidx) $sidx =1;</p>
<p>if(isset($_GET["nm_mask"]))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $nm_mask = $_GET[&#39;nm_mask&#39;];<br />else<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $nm_mask = &#8220;&#8221;;<br />if(isset($_GET["cd_mask"]))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $cd_mask = $_GET[&#39;cd_mask&#39;];<br />else<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $cd_mask = &#8220;&#8221;;<br />//construct where clause<br />$where = &#8220;WHERE 1=1&#8243;;<br />if($nm_mask!=&#39;&#39;)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $where.= &#8221; AND item LIKE &#39;$nm_mask%&#39;&#8221;;<br />if($cd_mask!=&#39;&#39;)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $where.= &#8221; AND item_cd LIKE &#39;$cd_mask%&#39;&#8221;;</p>
<p>// connect to the database<br />$dbhost = &#39;localhost&#39;;<br />$dbuser = &#39;root&#39;;<br />$dbpassword = &#39;pass&#39;;<br />$database = &#39;email&#39;;<br />$db = mysql_pconnect($dbhost, $dbuser, $dbpassword)<br />or die(&#8221;Connection Error: &#8221; . mysql_error());</p>
<p>mysql_select_db($database) or die(&#8221;Error conecting to db.&#8221;);</p>
<p>$result = mysql_query(&#8221;SELECT COUNT(*) AS count FROM items &#8220;.$where);<br />$row = mysql_fetch_array($result,MYSQL_ASSOC);<br />$count = $row[&#39;count&#39;];</p>
<p>if( $count &#62;0 ) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $total_pages = ceil($count/$limit);<br />} else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $total_pages = 0;<br />}<br />if ($page &#62; $total_pages) $page=$total_pages;<br />if ($limit&#60;0) $limit = 0;<br />$start = $limit*$page &#8211; $limit; // do not put $limit*($page &#8211; 1)<br />if ($start&#60;0) $start = 0;<br />$SQL = &#8220;SELECT item_id, item, item_cd FROM items &#8220;.$where.&#8221; ORDER BY $sidx $sord LIMIT $start , $limit&#8221;;<br />$result = mysql_query( $SQL ) or die(&#8221;Couldn&#39;t execute query.&#8221;.mysql_error());<br />$responce-&#62;page = $page;<br />$responce-&#62;total = $total_pages;<br />$responce-&#62;records = $count;<br />$i=0;<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;id&#39;]=$row[item_id];<br />&#160;&#160;&#160; $responce-&#62;rows[$i][&#39;cell&#39;]=array($row[item_id],$row[item],$row[item_cd]);<br />&#160;&#160;&#160; $i++;<br />}<br />echo $json-&#62;encode($responce); // coment if php 5<br />//echo json_encode($responce);<br />mysql_close($db);<br />?&#62;</p>
]]></description>
        	        	<pubDate>Wed, 30 Sep 2009 23:35:58 +0300</pubDate>
        </item>
</channel>
</rss>