<?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: Jgrid + Mysql</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql</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/jgrid-mysql/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Jgrid + Mysql</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12764</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12764</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>My recommendation is first to begin with very simple configuration. You have a lot of other error:</p>
<p>1. Again the comma problem at end of xmlReader - i.e you have</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8465' value='Select Code' data-codeid='sfcode8465' /></p>
<div class='sfcode' id='sfcode8465'>
<p>xmlReader : {</p>
<p>....</p>
<p>repeatitems:false, &#60;====Error</p>
<p>}</p>
</div>
<p>2. Looking at the same reader it seems like you turn repeatitems to false, but your output is for repeatitems : true</p>
</p>
<p>I&#160; recoommend you to begin to read the documentation:</p>
<p><a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#xml_data" rel="nofollow" target="_blank"><a href="http://www.trirand.com/jqgridw" rel="nofollow">http://www.trirand.com/jqgridw</a>.....a#xml_data</a></p>
</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 05 Dec 2009 14:46:33 +0200</pubDate>
        </item>
        <item>
        	<title>Splinter on Jgrid + Mysql</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12718</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12718</guid>
        	        	<description><![CDATA[<p>Thanks for the reply, i have cleared the comma but it&#39;s the same.</p>
<p>I have started a new grid (copy past&#160;from the basic instructions), and still does not work.</p>
<p>If i do not have any record on the table, the page loads withought errors.</p>
<p>If i do the error is shows as follows:</p>
<p>Message: Object required<br />Line: 12<br />Char: 7209<br />Code: 0<br />URI: <a href="http://localhost/jgrid/js/jquery-1.3.2.min.js" rel="nofollow" target="_blank"><a href="http://localhost/jgrid/js/jque" rel="nofollow">http://localhost/jgrid/js/jque</a>.....3.2.min.js</a></p></p>
]]></description>
        	        	<pubDate>Thu, 03 Dec 2009 16:56:12 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Jgrid + Mysql</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12700</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12700</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>The first error that I see is describing the colModel,</p>
<p>&#160;&#160;&#160; colModel :[ <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;id&#39;, index:&#39;id&#39;, width:55}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;nome&#39;, index:&#39;nome&#39;, width:90, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;login&#39;, index:&#39;login&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;ext&#39;, index:&#39;ext&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;tel&#39;, index:&#39;tel&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;pc&#39;, index:&#39;pc&#39;, width:150, editable:true},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;user&#39;, index:&#39;user&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;printer&#39;, index:&#39;printer&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;localp&#39;, index:&#39;localp&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;email&#39;, index:&#39;email&#39;, width:80, align:&#39;right&#39;, editable:true},&#160; <strong>&#60;=== Error</strong></p>
<p>],</p>
</p>
<p>Most browsers do not like this.</p>
<p>Regards</p>
<p>Tony</p></p>
]]></description>
        	        	<pubDate>Thu, 03 Dec 2009 13:34:27 +0200</pubDate>
        </item>
        <item>
        	<title>Splinter on Jgrid + Mysql</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12684</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jgrid-mysql#p12684</guid>
        	        	<description><![CDATA[<p>Hi,</p>
</p>
<p>I am currently trying to find problem in which my grid isn&#39;t working.</p>
<p>I have followed the &#8220;my first grid guide&#8221;, step by step, but it is not working. I soppose that i&#39;m missing something.</p>
<p>Firefox displays the page withought errors but does not populate the grid.</p>
<p>IE8 does display and error in line 12 in char 7209 of the jquery-1.3.2.min.js</p>
</p>
<p>Here are the details:</p>
<p>MySQL database: contactos</p>
<blockquote>
<p><input type='button' class='sfcodeselect' name='sfselectit4008' value='Select Code' data-codeid='sfcode4008' /></p>
<div class='sfcode' id='sfcode4008'>
<p>CREATE TABLE contactosgrid(<br />id int( 11 ) NOT NULL AUTO_INCREMENT ,<br />nome TEXT NOT NULL ,<br />login TEXT NOT NULL ,<br />ext int( 11 ) DEFAULT NULL ,<br />tel int( 11 ) DEFAULT NULL ,<br />pc TEXT NOT NULL ,<br />user int( 11 ) DEFAULT NULL ,<br />printer TEXT DEFAULT NULL ,<br />localp TEXT NOT NULL ,<br />email TEXT NOT NULL ,<br />PRIMARY KEY ( id ) );</p>
<p>INSERT INTO `contactos`.`contactosgrid` (`id`, `nome`, `login`, `ext`, `tel`, `pc`, `user`, `printer`, `localp`, `email`) VALUES (NULL, &#39;John Doe&#39;, &#39;U1235556&#39;, &#39;8433&#39;, &#39;5433&#39;, &#39;Computer183&#39;, &#39;000&#39;, NULL, &#39;IT&#39;, mailto:&#39;john.doe@contoso.com&#39;&#8220;&#62;<br />&#60;html xmlns=&#8221;<a onclick="function onclick() { pageTracker._trackPageview(&#39;/outbound/article/http://www.w3.org/1999/xhtml&#39;); }" href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>&#8221; xml:lang=&#8221;en&#8221; lang=&#8221;en&#8221;&#62;<br />&#60;head&#62;<br />&#60;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&#62;<br />&#60;title&#62;My First Grid&#60;/title&#62;<br />&#160;<br />&#60;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; href=&#8221;css/redmond/jquery-ui-1.7.1.custom.css&#8221; /&#62;<br />&#60;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; href=&#8221;css/ui.jqgrid.css&#8221; /&#62;<br />&#160;<br />&#160;&#60;style&#62;<br />html, body {<br />&#160;&#160;&#160; margin: 0;<br />&#160;&#160;&#160; padding: 0;<br />&#160;&#160;&#160; font-size: 75%;<br />}<br />&#60;/style&#62;<br />&#160;<br />&#60;script src=&#8221;js/jquery-1.3.2.min.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;<br />&#60;script src=&#8221;js/i18n/grid.locale-en.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;<br />&#60;script src=&#8221;js/jquery.jqGrid.min.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;</p>
<p>&#60;script type=&#8221;text/javascript&#8221;&#62;<br />var lastSel;<br />var rowid;<br />var keys;<br />var oneditfunc;<br />var succesfunc;<br />var url;<br />var extraparam;<br />var aftersavefunc;<br />var errorfunc;<br />var afterrestorefunc;</p>
<p>jQuery(document).ready(function(){ <br />&#160; jQuery(&#8221;#list&#8221;).jqGrid({<br />&#160;&#160;&#160; <a href="/blog/&#39;example.php&#39;" target="_blank">url:&#39;example.php&#39;</a>,<br />&#160;&#160;&#160; datatype: &#39;xml&#39;,<br />&#160;&#160;&#160; mtype: &#39;GET&#39;,<br />&#160;&#160;&#160; colNames:[&#39;Id&#39;,&#39;Nome&#39;, &#39;Login&#39;,&#39;Ext&#39;,&#39;Tel&#39;,&#39;PC&#39;,&#39;User&#39;,&#39;Printer&#39;,&#39;Local&#39;,&#39;Email&#39;],<br />&#160;&#160;&#160; colModel :[ <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;id&#39;, index:&#39;id&#39;, width:55}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;nome&#39;, index:&#39;nome&#39;, width:90, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;login&#39;, index:&#39;login&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;ext&#39;, index:&#39;ext&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;tel&#39;, index:&#39;tel&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;pc&#39;, index:&#39;pc&#39;, width:150, editable:true},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;user&#39;, index:&#39;user&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;printer&#39;, index:&#39;printer&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;localp&#39;, index:&#39;localp&#39;, width:80, align:&#39;right&#39;, editable:true}, <br />&#160;&#160;&#160;&#160;&#160; {name:&#39;email&#39;, index:&#39;email&#39;, width:80, align:&#39;right&#39;, editable:true},</p>
<p>&#160;&#160;&#160; ],<br />&#160;&#160; xmlReader: { <br />&#160;&#160;&#160;&#160;&#160; root:&#8221;rows&#8221;, <br />&#160;&#160;&#160;&#160;&#160; row:&#8221;row&#8221;,<br />&#160;&#160;&#160;&#160;&#160; page:&#8221;rows&#62;page&#8221;, <br />&#160;&#160;&#160;&#160;&#160; total:&#8221;rows&#62;total&#8221;, <br />&#160;&#160;&#160;&#160;&#160; records:&#8221;rows&#62;records&#8221;,<br />&#160;&#160;&#160;&#160;&#160; repeatitems:false,</p>
<p>&#160; },</p>
<p>&#160;&#160;&#160; pager: &#39;#pager&#39;,<br />&#160;&#160;&#160; rowNum:500,<br />&#160;&#160;&#160; rowList:[10,20,30],<br />&#160;&#160;&#160; sortname: &#39;id&#39;,<br />&#160;&#160;&#160; sortorder: &#39;desc&#39;,<br />&#160;&#160;&#160; viewrecords: true,<br />&#160;loadonce: true,<br />&#160;&#160;&#160; caption: &#39;Lista Contactos&#39;</p>
<p>&#160; }).navGrid(&#39;#pager&#39;,{view:true, del:true},&#160;</p>
<p>{reloadAfterSubmit:false, }, // edit options<br />{reloadAfterSubmit:false,}, // add options<br />{reloadAfterSubmit:false}, // del options<br />{Find: &#8220;Go&#8221;, multipleSearch:true,} // search options<br />);<br />//{edit:true,add:true,del:true});&#160;<br />});<br />&#60;/script&#62;</p>
<p>&#60;/head&#62;<br />&#60;body&#62;<br />&#60;table id=&#8221;list&#8221;&#62;&#60;/table&#62; <br />&#60;div id=&#8221;pager&#8221;&#62;&#60;/div&#62; <br />&#60;/body&#62;<br />&#60;/html&#62;</p>
</div>
</blockquote>
<p>PHP Example.php:</p>
<blockquote>
<p><input type='button' class='sfcodeselect' name='sfselectit9260' value='Select Code' data-codeid='sfcode9260' /></p>
<div class='sfcode' id='sfcode9260'>
<blockquote>
<p>&#60;?php <br />//include the information needed for the connection to MySQL data base server. <br />// we store here username, database and password</p>
<p>$dbhost = "localhost";<br />$dbuser = "root";<br />$dbpassword = "password#123";<br />$database = "contactos";<br />&#160;<br />// to the url parameter are added 4 parameters as described in colModel<br />// we should get these parameters to construct the needed query<br />// Since we specify in the options of the grid that we will use a GET method <br />// we should use the appropriate command to obtain the parameters. <br />// In our case this is $_GET. If we specify that we want to use post <br />// we should use $_POST. Maybe the better way is to use $_REQUEST, which<br />// contain both the GET and POST variables. For more information refer to php documentation.<br />// Get the requested page. By default grid sets this to 1. <br />$page = $_GET[&#39;page&#39;]; <br />&#160;<br />// get how many rows we want to have into the grid &#8211; rowNum parameter in the grid <br />$limit = $_GET[&#39;rows&#39;]; <br />&#160;<br />// get index row &#8211; i.e. user click to sort. At first time sortname parameter -<br />// after that the index from colModel <br />$sidx = $_GET[&#39;sidx&#39;]; <br />&#160;<br />// sorting order &#8211; at first time sortorder <br />$sord = $_GET[&#39;sord&#39;]; <br />&#160;<br />// if we not pass at first time index use the first column for the index or what you want<br />if(!$sidx) $sidx =1; <br />&#160;<br />// connect to the MySQL database server <br />$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die(&#8221;Connection Error: &#8221; . mysql_error()); <br />&#160;<br />// select the database <br />mysql_select_db($database) or die(&#8221;Error connecting to db.&#8221;); <br />&#160;<br />// calculate the number of rows for the query. We need this for paging the result <br />$result = mysql_query(&#8221;SELECT COUNT(*) AS count FROM contactosgrid&#8221;); <br />$row = mysql_fetch_array($result,MYSQL_ASSOC); <br />$count = $row[&#39;count&#39;]; <br />&#160;<br />// calculate the total pages for the query <br />if( $count &#62; 0 &#38;&#38; $limit &#62; 0) { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $total_pages = ceil($count/$limit); <br />} else { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $total_pages = 0; <br />} <br />&#160;<br />// 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;<br />&#160;<br />// calculate the starting position of the rows <br />$start = $limit*$page &#8211; $limit;<br />&#160;<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; <br />&#160;<br />// the actual query for the grid data <br />$SQL = &#8220;SELECT id, nome, login, ext, tel, pc, user, printer, localp, email FROM contactosgrid 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 />&#160;<br />// we should set the appropriate header information. Do not forget this.<br />header(&#8221;Content-type: text/xml;charset=utf-8&#8243;);<br />&#160;<br />$s = &#8220;&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;&#8221;;<br />$s .=&#160; &#8220;&#60;rows&#62;&#8221;;<br />$s .= &#8220;&#60;page&#62;&#8221;.$page.&#8221;&#60;/page&#62;&#8221;;<br />$s .= &#8220;&#60;total&#62;&#8221;.$total_pages.&#8221;&#60;/total&#62;&#8221;;<br />$s .= &#8220;&#60;records&#62;&#8221;.$count.&#8221;&#60;/records&#62;&#8221;;<br />&#160;<br />// be sure to put text data in CDATA<br />while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160; $s .= &#8220;&#60;row id=&#39;&#8221;. $row[id].&#8221;&#39;&#62;&#8221;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#8221;. $row[id].&#8221;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[nome].&#8221;]]&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[login].&#8221;]]&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#8221;. $row[ext].&#8221;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#8221;. $row[tel].&#8221;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[pc].&#8221;]]&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[user].&#8221;]]&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[printer].&#8221;]]&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[localp].&#8221;]]&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[email].&#8221;]]&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;cell&#62;&#60;![CDATA[". $row[note].&#8221;]]&#62;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; $s .= &#8220;&#60;/row&#62;&#8221;;<br />}<br />$s .= &#8220;&#60;/rows&#62;&#8221;; <br />&#160;<br />echo $s;<br />?&#62;</p>
</blockquote>
</div>
</blockquote>
<p>Need help!!</p></p>
]]></description>
        	        	<pubDate>Wed, 02 Dec 2009 19:00:04 +0200</pubDate>
        </item>
</channel>
</rss>