<?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: php mysql data</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/php-mysql-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/php-mysql-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>eljaywilson on php mysql data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11997</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11997</guid>
        	        	<description><![CDATA[<p>Send me script files and let me play with it. &#160;Leave out database connection info, instead just give me table layout info and I will just create a table on my DB and stick some dummy data in it.</p>
</p>
<p>Can zip it all up and send to:</p>
<p>eljaywilson_at_gmail_dot_com</p>
]]></description>
        	        	<pubDate>Mon, 16 Nov 2009 17:11:32 +0200</pubDate>
        </item>
        <item>
        	<title>Dmoney on php mysql data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11996</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11996</guid>
        	        	<description><![CDATA[<p>thanks&#160;eljaywilson for your reply,</p>
<p>I tried what you suggested but I&#39;m getting the same results. Valid xml when I look at the file directly but nothing shows up in the grid. &#160;I think it must be reading my page as the source php instead of as the output. &#160;It&#39;s the only thing that makes sense to me. &#160;I tried using the full path to the file as well but that did not help either.</p></p>
]]></description>
        	        	<pubDate>Mon, 16 Nov 2009 17:01:13 +0200</pubDate>
        </item>
        <item>
        	<title>eljaywilson on php mysql data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11986</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11986</guid>
        	        	<description><![CDATA[<p>I don&#39;t use XML anymore (JSON is soooo much easier) but I would try to build the whole XML output into a variable and then output that all at once.</p>
<p>[code]</p>
</p>
<p>$myvar = &#160;&#8220;&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;&#8221;;</p>
<p>$myvar.="&#60;rows&#62;";</p>
<p>etc....</p>
</p>
<p>[/code]</p>
</p>
<p>Here is an example of some of my old code:</p>
</p>
<p>[code]</p>
</p>
<div>$return_value = &#39;&#60;?xml version="1.0"?&#62;&#60;root&#62;</div>
<div>&#60;storename&#62;&#39;. $storename .&#39;&#60;/storename&#62;&#60;storeaddress&#62;&#39;.$storeaddress.&#39;&#60;/storeaddress&#62;</div>
<div>&#60;storecity&#62;&#39;.$storecity.&#39;&#60;/storecity&#62;&#60;storestate&#62;&#39;.$storestate.&#39;&#60;/storestate&#62;</div>
<div><span> </span>&#60;storezip&#62;&#39;.$storezip.&#39;&#60;/storezip&#62;&#60;storephone&#62;&#39;.$storephone.&#39;&#60;/storephone&#62;</div>
<div><span> </span>&#60;storetax&#62;&#39;.$storetax.&#39;&#60;/storetax&#62;&#60;storeid&#62;&#39;.$storeid.&#39;&#60;/storeid&#62;</div>
<div><span> </span>&#60;registernum&#62;&#39;.$registernum.&#39;&#60;/registernum&#62;</div>
<div><span> </span>&#60;checkreader&#62;&#39;.$checkreader.&#39;&#60;/checkreader&#62;</div>
<div><span> </span>&#60;workspace1&#62;&#39;.$workspace1.&#39;&#60;/workspace1&#62;</div>
<div><span> </span>&#60;workspace2&#62;&#39;.$workspace2.&#39;&#60;/workspace2&#62;</div>
<div><span> </span>&#60;workspace3&#62;&#39;.$workspace3.&#39;&#60;/workspace3&#62;</div>
<div><span> </span>&#60;pole&#62;&#39;.$pole.&#39;&#60;/pole&#62;</div>
<div><span> </span>&#60;cc_processing&#62;&#39;.$cc_processing.&#39;&#60;/cc_processing&#62;</div>
<div><span> </span>&#60;auto_logout&#62;&#39;.$auto_logout.&#39;&#60;/auto_logout&#62;</div>
<div><span> </span>&#60;mgr_check_cashing&#62;&#39;.$mgr_check_cashing.&#39;&#60;/mgr_check_cashing&#62;</div>
<div><span> </span>&#60;chg_acct_posting&#62;&#39;.$chg_acct_posting.&#39;&#60;/chg_acct_posting&#62;</div>
<div><span> </span>&#60;cc_test_mode&#62;&#39;.$cc_test_mode.&#39;&#60;/cc_test_mode&#62;</div>
<div><span> </span>&#60;ipaddress&#62;&#39; .$remoteip . &#39;&#60;/ipaddress&#62;&#39;;</div>
<div><span> </span></div>
<div><span> </span></div>
<div></div>
<div>$sql ="select departmentname AS DEPTNAME, taxable AS DEPTTAX from tblDepartments ORDER BY departmentid ASC" ;</div>
<div><span> </span>$rs = $db-&#62;query($sql);</div>
<div><span> </span>while ($row = $db-&#62;fetch_array($rs))</div>
<div><span> </span>{</div>
<div><span> </span>$return_value.= &#39;&#60;dept&#62;</div>
<div><span> </span>&#60;deptname&#62;&#39; . $row[&#39;DEPTNAME&#39;] . &#39;&#60;/deptname&#62;</div>
<div><span> </span>&#60;depttax&#62;&#39; . $row[&#39;DEPTTAX&#39;] . &#39;&#60;/depttax&#62;</div>
<div><span> </span>&#60;/dept&#62;&#39;;</div>
<div><span> </span>}</div>
<div><span> </span></div>
<div><span> </span>$return_value.=&#39;&#60;/root&#62;&#39;;<span> </span>&#160;&#160;</div>
<div>[/code]</div>
<div></div>
<div>Then at the bottom of the page use this to output it:</div>
<div></div>
<div>[/code]</div>
<div></div>
<div>
<div>// Add header information so that IE won&#39;t cache the response</div>
<div>header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); &#160; &#160;// Date in the past</div>
<div>header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");</div>
<div>header ("Cache-Control: no-cache, must-revalidate"); &#160;// HTTP/1.1</div>
<div>header ("Pragma: no-cache");</div>
<div>header("content-type: text/xml");</div>
<div>echo $return_value; // This will become the response value for the XMLHttpRequest object</div>
</div>
<p>[/code]</p>
</p>
<p>HTH</p>
]]></description>
        	        	<pubDate>Mon, 16 Nov 2009 11:48:29 +0200</pubDate>
        </item>
        <item>
        	<title>Dmoney on php mysql data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11923</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11923</guid>
        	        	<description><![CDATA[<p>I&#39;m still fighting with this. &#160;I am using php 5.1.4 thats why I&#39;m stuck using the XML data format instead of trying to see if I can get json to work instead.</p>
</p>
<p>Again the output of my php file is valid xml. &#160;if I copy and paste the output into a static file with an .xml extension the grid displays perfectly. &#160;Also I do believe now that the header information is correct.</p>
</p>
<p>Any suggestions?</p>
]]></description>
        	        	<pubDate>Fri, 13 Nov 2009 12:42:00 +0200</pubDate>
        </item>
        <item>
        	<title>Dmoney on php mysql data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11852</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11852</guid>
        	        	<description><![CDATA[<p>still can&#39;t get dynamic xml to work. &#160;copying and pasting the output into a static file works fine though.</p>
]]></description>
        	        	<pubDate>Thu, 12 Nov 2009 10:42:53 +0200</pubDate>
        </item>
        <item>
        	<title>Dmoney on php mysql data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11810</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/php-mysql-data#p11810</guid>
        	        	<description><![CDATA[<p>I wonder if anyone has run into this. &#160;I&#39;m trying to create the xml data from mysql using php. &#160;When I do this I get no records displaying. &#160;however when I run my php file on its own, if i do a view source and copy the output to a file called static.xml and use that file instead all the data works fine. &#160;so it makes me think the output from php is fine. &#160;but just changing the filename from static.xml to data.php. &#160;Makes the data go away. &#160;any suggestions?</p>
</p>
<p>I think it must be something witht he header but I can&#39;t figure it out. &#160;I tried taking out the if statement and just using&#160;</p>
</p>
<p>header ("content-type: text/xml");</p>
</p>
<p>but I get the same result</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1573' value='Select Code' data-codeid='sfcode1573' /></p>
<div class='sfcode' id='sfcode1573'>
<p>&#60;?php</p>
<p>$page = $_GET[&#39;page&#39;]; // get the requested page</p>
<p>$limit = $_GET[&#39;rows&#39;]; // get how many rows we want to have into the grid</p>
<p>$sidx = $_GET[&#39;sidx&#39;]; // get index row &#8211; i.e. user click to sort</p>
<p>$sord = $_GET[&#39;sord&#39;]; // get the direction</p>
<p>if(!$sidx) $sidx =1;</p>
<p>// connect to the database</p>
</p>
<p>require &#8220;db.php&#8221;;</p>
</p>
<p>$result = mysql_query(&#8221;SELECT COUNT(*) AS count FROM Cert_Itm&#8221;);</p>
<p>$row = mysql_fetch_array($result,MYSQL_ASSOC);</p>
<p>$count = $row[&#39;count&#39;];</p>
</p>
<p>if( $count &#62;0 ) {</p>
<p><span> </span>$total_pages = ceil($count/$limit);</p>
<p>} else {</p>
<p><span> </span>$total_pages = 0;</p>
<p>}</p>
<p>if ($page &#62; $total_pages) $page=$total_pages;</p>
<p>$start = $limit*$page &#8211; $limit; // do not put $limit*($page &#8211; 1)</p>
<p>$SQL = &#8220;SELECT CertRefNo, CertItemNo, ClientId, ItemDesc FROM Cert_Itm ORDER BY $sidx $sord LIMIT $start , $limit&#8221;;</p>
<p>$result = mysql_query( $SQL ) or die(&#8221;Couldn&#39;t execute query.&#8221;.mysql_error());</p>
</p>
<p>if ( stristr($_SERVER["HTTP_ACCEPT"],&#8221;application/xhtml+xml&#8221;) ) {</p>
<p>header(&#8221;Content-type: application/xhtml+xml;charset=utf-8&#8243;); } else {</p>
<p>header(&#8221;Content-type: text/xml;charset=utf-8&#8243;);</p>
<p>}</p>
<p>$et = &#8220;&#62;&#8221;;</p>
</p>
<p>echo &#8220;&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?$et\\n&#8221;;</p>
<p>echo &#8220;&#60;rows&#62;&#8221;;</p>
<p>echo &#8220;&#60;page&#62;&#8221;.$page.&#8221;&#60;/page&#62;&#8221;;</p>
<p>echo &#8220;&#60;total&#62;&#8221;.$total_pages.&#8221;&#60;/total&#62;&#8221;;</p>
<p>echo &#8220;&#60;records&#62;&#8221;.$count.&#8221;&#60;/records&#62;&#8221;;</p>
<p>// be sure to put text data in CDATA</p>
<p>while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {</p>
<p><span> </span>echo &#8220;&#60;row id=&#39;&#8221;. $row[CertRefNo].&#8221;&#39;&#62;&#8221;;<span> </span></p>
<p><span> </span>echo &#8220;&#60;cell&#62;&#8221;. $row[CertRefNo].&#8221;&#60;/cell&#62;&#8221;;</p>
<p><span> </span>echo &#8220;&#60;cell&#62;&#8221;. $row[CertItemNo].&#8221;&#60;/cell&#62;&#8221;;</p>
<p><span> </span>echo &#8220;&#60;cell&#62;&#8221;. $row[ClientId].&#8221;&#60;/cell&#62;&#8221;;</p>
<p><span> </span>echo &#8220;&#60;cell&#62;&#8221;. $row[ItemDesc].&#8221;&#60;/cell&#62;&#8221;;</p>
<p><span> </span>echo &#8220;&#60;/row&#62;&#8221;;</p>
<p>}</p>
<p>echo &#8220;&#60;/rows&#62;&#8221;;<span> </span></p>
<p>?&#62;</p>
</div>
]]></description>
        	        	<pubDate>Wed, 11 Nov 2009 14:31:18 +0200</pubDate>
        </item>
</channel>
</rss>