<?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: "j is undefined"...?</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/j-is-undefined</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/j-is-undefined/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>bluehat on "j is undefined"...?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/j-is-undefined#p6363</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/j-is-undefined#p6363</guid>
        	        	<description><![CDATA[<p>Nevermind, had one too many fields in my XML... woops.</p>
]]></description>
        	        	<pubDate>Tue, 28 Apr 2009 13:05:55 +0300</pubDate>
        </item>
        <item>
        	<title>bluehat on "j is undefined"...?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/j-is-undefined#p6362</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/j-is-undefined#p6362</guid>
        	        	<description><![CDATA[<p>I&#39;ve been using FireBug on my code, and I&#39;m getting the following:</p>
<p><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened"></span></p>
<div class="errorTrace">
<div class="objectBox objectBox-stackFrame">j is undefined</div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">jqGrid()</a>()<span class="objectLink-sourceLink objectLink">grid.base-min.js (line 9)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">jqGrid()</a>()<span class="objectLink-sourceLink objectLink">grid.base-min.js (line 9)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">jqGrid()</a>()<span class="objectLink-sourceLink objectLink">grid.base-min.js (line 9)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">init()</a>()<span class="objectLink-sourceLink objectLink">jquery.js (line 12)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">init()</a>()<span class="objectLink-sourceLink objectLink">jquery.js (line 12)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">jqGrid()</a>()<span class="objectLink-sourceLink objectLink">grid.base-min.js (line 9)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">init()</a>()<span class="objectLink-sourceLink objectLink">jquery.js (line 12)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">init()</a>()<span class="objectLink-sourceLink objectLink">jquery.js (line 12)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">M</a>()<span class="objectLink-sourceLink objectLink">grid.base-min.js (line 9)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">jqGrid()</a>()<span class="objectLink-sourceLink objectLink">grid.base-min.js (line 9)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">L</a>()<span class="objectLink-sourceLink objectLink">jquery.js (line 19)</span></div>
<div class="objectBox objectBox-stackFrame"><a class="objectLink" target="_blank">F()</a>()<span class="objectLink-sourceLink objectLink">jquery.js (line 19)</span></div>
</div>
<div class="errorSourceBox errorSource-exec">[Image Can Not Be Found]<span class="errorSource">;(function(b){b.fn.jqGrid=function(x){x=&#8230;is.grid=null;this.p=null})})}})(jQuery);</span></div>
<div class="errorSourceBox errorSource-exec"></div>
<div class="errorSourceBox errorSource-exec"></div>
<div class="errorSourceBox errorSource-exec">I haven&#39;t edited any of the code, when I changed my fields around is when this popped up.</div>
<div class="errorSourceBox errorSource-exec"></div>
<div class="errorSourceBox errorSource-exec">My html:</div>
<div class="errorSourceBox errorSource-exec"></div>
<div class="errorSourceBox errorSource-exec">
<p><input type='button' class='sfcodeselect' name='sfselectit1451' value='Select Code' data-codeid='sfcode1451' /></p>
<div class='sfcode' id='sfcode1451'>&#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#038;gt" rel="nofollow" target="_blank"><a href="http://www.w3.org/TR/xhtml1/DT" rel="nofollow">http://www.w3.org/TR/xhtml1/DT</a>.....o;&#038;gt</a>;<br />&#60;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml&#8221;&#038;gt" rel="nofollow" target="_blank"><a href="http://www.w3.org/1999/xhtml&#038;r" rel="nofollow">http://www.w3.org/1999/xhtml&#038;r</a>.....o;&#038;gt</a>;<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;PRODUCT INVENTORY&#60;/title&#62;<br />&#60;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; href=&#8221;themes/basic/grid.css&#8221; /&#62;<br />&#60;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; media=&#8221;screen&#8221; href=&#8221;themes/jqModal.css&#8221; /&#62;<br />&#60;style&#62;<br />BODY {<br />font-family:Verdana, Arial, Helvetica, sans-serif;<br />font-size:10px;<br />}<br />#sp_1,#sp_2 {<br />position:relative;<br />top:3px;<br />}<br />&#60;/style&#62;<br />&#60;script src=&#8221;js/jquery.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;<br />&#60;script src=&#8221;js/jquery.jqGrid.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;<br />&#60;script src=&#8221;js/jqModal.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;<br />&#60;script src=&#8221;js/jqDnR.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;<br />&#60;script src=&#8221;js/grid.formedit.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62;<br />&#60;script type=&#8221;text/javascript&#8221;&#62;<br />jQuery(document).ready(function(){</p>
<p>&#160;&#160;&#160; jQuery(&#8221;#list2&#8243;).jqGrid({<br />&#160;&#160;&#160; caption:&#39;Product Inventory&#39;,<br />&#160;&#160;&#160; colModel:[<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;iid&#39;,index:&#39;iid&#39;, width:55,editable:true,editoptions:{size:10}}, // SQL line number<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;code&#39;,index:&#39;code&#39;, width:55,editable:true,editoptions:{readonly:true,size:10}}, // Vendor code<br />&#160;&#160;&#160; &#160;&#160;&#160; // ln - line number<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;price&#39;,index:&#39;price&#39;, width:55,editable:true,editoptions:{size:10}}, // Base item price<br />&#160;&#160;&#160; &#160;&#160;&#160; // stran - transaction number<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;active&#39;,index:&#39;active&#39;, width:55,editable:true,edittype:"checkbox",editoptions:{size:10,value:"Yes:No"}}, // Active item?<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;itemcd&#39;,index:&#39;itemcd&#39;, width:55,editable:true,editoptions:{size:10}}, // Item CD<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;buycde&#39;,index:&#39;buycde&#39;, width:55,editable:true,editoptions:{size:10}}, // Buyer code for item<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;odate&#39;,index:&#39;odate&#39;, width:55,editable:true,editoptions:{size:10}}, // Item creation date<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;idate&#39;,index:&#39;idate&#39;, width:55,editable:true,editoptions:{size:10}}, // Date of last sale<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;cost&#39;,index:&#39;cost&#39;, width:55,editable:true,editoptions:{size:10}}, // Item price<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;lstcost&#39;,index:&#39;lstcost&#39;, width:55,editable:true,editoptions:{size:10}}, // Last cost of item<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;stdcost&#39;,index:&#39;stdcost&#39;, width:55,editable:true,editoptions:{size:10}}, // Standard cost<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;qtyonh&#39;,index:&#39;qtyonh&#39;, width:55,editable:true,editoptions:{size:10}}, // Quantity on hand<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;qtyall&#39;,index:&#39;qtyall&#39;, width:55,editable:true,editoptions:{size:10}}, // Quantity allocated<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;descr1&#39;,index:&#39;descr1&#39;, width:55,editable:true,edittype:"textarea",editoptions:{rows:"2",cols:"20"}}, // First desc line<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;descr2&#39;,index:&#39;descr2&#39;, width:55,editable:true,edittype:"textarea",editoptions:{rows:"2",cols:"20"}}, // Second desc line<br />&#160;&#160;&#160; &#160;&#160;&#160; // costgln - GL account number item is distributed to<br />&#160;&#160;&#160; &#160;&#160;&#160; // salegln - GL account number item is distributed to<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;qtybo&#39;,index:&#39;qtybo&#39;, width:55,editable:true,editoptions:{size:10}}, // Quantity backordered<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;qtyono&#39;,index:&#39;qtyono&#39;, width:55,editable:true,editoptions:{size:10}}, // Quantity on order<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;unitms&#39;,index:&#39;unitms&#39;, width:55,editable:true,editoptions:{size:10}}, // Unit of measurement<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;binloc&#39;,index:&#39;binloc&#39;, width:55,editable:true,editoptions:{size:10}}, // Bin location code<br />&#160;&#160;&#160; &#160;&#160;&#160; // loc - location code for this item<br />&#160;&#160;&#160; &#160;&#160;&#160; // abccd - code for ABC analysis<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;reord&#39;,index:&#39;reord&#39;, width:55,editable:true,editoptions:{size:10}}, // Reorder level<br />&#160;&#160;&#160; &#160;&#160;&#160; // cyccnt - Cycle count code<br />&#160;&#160;&#160; &#160;&#160;&#160; // cutqty = Enter cutoff quantity for a physical count<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;lcntdat&#39;,index:&#39;lcntdat&#39;, width:55,editable:true,editoptions:{size:10}}, // Date of last inventory count<br />&#160;&#160;&#160; &#160;&#160;&#160; // barcd - Enter the barcode value for this item<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;catg&#39;,index:&#39;catg&#39;, width:55,editable:true,editoptions:{size:10}}, // Item category<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;weight&#39;,index:&#39;weight&#39;, width:55,editable:true,editoptions:{size:10}}, // Item weight<br />&#160;&#160;&#160; &#160;&#160;&#160; // serflag - Does the item require a serial number<br />&#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;taxflag&#39;,index:&#39;taxflag&#39;, width:55,editable:true,edittype:"checkbox",editoptions:{size:10,value:"Yes:No"}} // Taxable item?<br />&#160;&#160;&#160; ],<br />&#160;&#160;&#160; colNames:[&#39;iid&#39;,&#39;Vendor Code&#39;,&#39;Price&#39;,&#39;Active?&#39;,&#39;Item Code&#39;,&#39;Buyer Code&#39;,<br />&#160;&#160;&#160; &#39;Created&#39;,&#39;Last Sold&#39;,&#39;Price&#39;,&#39;Last Cost&#39;,&#39;Standard Cost&#39;,&#39;Quantity&#39;,<br />&#160;&#160;&#160; &#39;Quantity Allocated&#39;,&#39;Description&#39;,&#39;Description2&#39;,&#39;Quantity On Hand&#39;,&#39;Quantity Backordered&#39;,<br />&#160;&#160;&#160; &#39;Unit of Measurement&#39;,&#39;Bin Location Code&#39;,&#39;Reorder Level&#39;,&#39;Last Inventory Count&#39;,<br />&#160;&#160;&#160; &#39;Item Cateogry&#39;,&#39;Item Weight&#39;,&#39;Taxable&#39;], <br />&#160;&#160;&#160; datatype: &#39;xml&#39;,<br />&#160;&#160;&#160; imgpath:&#39;themes/basic/images&#39;,<br />&#160;&#160;&#160; mtype:&#39;GET&#39;,<br />&#160;&#160;&#160; pager:jQuery(&#39;#pager2&#39;),<br />&#160;&#160;&#160; rowNum:10, rowList:[10,20,40],<br />&#160;&#160;&#160; height:175,<br />&#160;&#160;&#160; sortname:&#39;iid&#39;,sortorder:&#39;asc&#39;,<br />&#160;&#160;&#160; url:&#39;as_inventory.php&#39;,<br />&#160;&#160;&#160; editurl:&#39;as_inventory.php&#39;,<br />&#160;&#160;&#160; viewrecords:true,<br />&#160;&#160;&#160; altRows:true,<br />&#160;&#160;&#160; loadtext:&#39;Retrieving Data&#8230;&#39;<br />&#160;&#160;&#160; });<br />&#160;&#160;&#160; <br />&#160;&#160;&#160; jQuery(&#8221;#list2&#8243;).navGrid(&#39;#pager2&#39;,<br />&#160;&#160;&#160; {height:280,reloadAfterSubmit:false,editCaption:&#39;Edit&#39;}, // edit options<br />&#160;&#160;&#160; {height:280,reloadAfterSubmit:false,addCaption:&#39;Add&#39;}, // add options<br />&#160;&#160;&#160; {height:280,reloadAfterSubmit:false,caption:&#39;Delete&#39;}, // del options<br />&#160;&#160;&#160; {reloadAfterSubmit:false} //search options<br />&#160;&#160;&#160; );<br />});<br />&#60;/script&#62;<br />&#60;/head&#62;</p>
<p>&#60;body&#62;<br />&#60;!&#8211; the grid definition in html is a table tag with class &#39;scroll&#39; &#8211;&#62;<br />&#60;table id=&#8221;list2&#8243; class=&#8221;scroll&#8221; cellpadding=&#8221;0&#8243; cellspacing=&#8221;0&#8243;&#62;&#60;/table&#62;</p>
<p>&#60;!&#8211; pager definition. class scroll tels that we want to use the same theme as grid &#8211;&#62;<br />&#60;div id=&#8221;pager2&#8243; class=&#8221;scroll&#8221; style=&#8221;text-align:center;&#8221;&#62;&#60;/div&#62;</p>
<p>&#60;/body&#62;<br />&#60;/html&#62;</p>
</div>
</div>
<div class="errorSourceBox errorSource-exec"></div>
<div class="errorSourceBox errorSource-exec">My PHP:</div>
<div class="errorSourceBox errorSource-exec"></div>
<div class="errorSourceBox errorSource-exec">
<p><input type='button' class='sfcodeselect' name='sfselectit2420' value='Select Code' data-codeid='sfcode2420' /></p>
<div class='sfcode' id='sfcode2420'>&#60;?<br />// DB CONNECTOR PARAMETERS<br />require(&#39;as_dbconfig.php&#39;);</p>
<p>// DISPLAY GRID<br />if (($_GET[&#39;_search&#39;] == &#39;false&#39;)) {<br />&#160;&#160;&#160; // Page parameters<br />&#160;&#160;&#160; $page&#160; = $_REQUEST[&#39;page&#39;];<br />&#160;&#160;&#160; $limit = $_REQUEST[&#39;rows&#39;];<br />&#160;&#160;&#160; $sidx&#160; = $_REQUEST[&#39;sidx&#39;];<br />&#160;&#160;&#160; $sord&#160; = $_REQUEST[&#39;sord&#39;]; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; $db = mysql_connect($dbhost, $dbuser, $dbpassword)<br />&#160;&#160;&#160; or die(&#8221;Connection Error: &#8221; . mysql_error());<br />&#160;&#160;&#160; mysql_select_db($database) or die(&#8221;Error conecting to db.&#8221;);<br />&#160;&#160;&#160; $result = mysql_query(&#8221;SELECT COUNT(*) AS count FROM imsim&#8221;); <br />&#160;&#160;&#160; $row = mysql_fetch_array($result,MYSQL_ASSOC); <br />&#160;&#160;&#160; $count = $row[&#39;count&#39;]; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; if( $count &#62; 0 ) { <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; $total_pages = ceil($count/$limit); <br />&#160;&#160;&#160; } else { <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; $total_pages = 0; <br />&#160;&#160;&#160; } <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; if ($page &#62; $total_pages) {$page = $total_pages;}<br />&#160;&#160;&#160; $start = $limit * $page - $limit;<br />&#160;&#160;&#160; if($start &#60; 0) {$start = 0;} <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; $dsp = &#8220;SELECT * FROM imsim ORDER BY $sidx $sord LIMIT $start, $limit&#8221;;<br />&#160;&#160;&#160; // $dsp = &#8220;SELECT id,invdate,client_id,amount,tax,total,note,closed,ship_via FROM invheader ORDER BY $sidx $sord LIMIT $start , $limit&#8221;; <br />&#160;&#160;&#160; $result = mysql_query($dsp) or die(&#8221;Couldn&#39;t execute query.&#8221;.mysql_error()); <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; // XML header<br />&#160;&#160;&#160; if ( stristr($_SERVER["HTTP_ACCEPT"],&#8221;application/xhtml+xml&#8221;) ) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; header(&#8221;Content-type: application/xhtml+xml;charset=utf-8&#8243;); <br />&#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; header(&#8221;Content-type: text/xml;charset=utf-8&#8243;);<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; echo &#8220;&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;rows&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;page&#62;&#8221; . $page . &#8220;&#60;/page&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;total&#62;&#8221; . $total_pages . &#8220;&#60;/total&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;records&#62;&#8221; . $count . &#8220;&#60;/records&#62;&#8221;;<br />&#160;&#160;&#160; <br />&#160;&#160;&#160; // Put text data in CDATA tags<br />&#160;&#160;&#160; while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;row id=&#39;&#8221;. $row[iid].&#8221;&#39;&#62;&#8221;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[iid] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[code] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[price] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[active] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[itemcd] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[buycde] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[odate] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[idate] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[cost] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[lstcost] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[stdcost] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtyonh] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtyall] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#60;![CDATA[" . $row[descr1] . &#8220;]]&#62;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#60;![CDATA[" . $row[descr2] . &#8220;]]&#62;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtybo] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtyono] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[unitms] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[binloc] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[reord] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[lcntdat] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[catg] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[weight] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[taxflag] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#60;![CDATA[" . $row[note] . &#8220;]]&#62;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;/row&#62;&#8221;;<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; echo &#8220;&#60;/rows&#62;&#8221;; </p>
<p>// SEARCH GRID<br />} elseif ($_GET[&#39;_search&#39;] == &#39;true&#39;) {<br />&#160;&#160;&#160; <br />&#160;&#160;&#160; // Page parameters<br />&#160;&#160;&#160; $page&#160; = $_REQUEST[&#39;page&#39;];<br />&#160;&#160;&#160; $limit = $_REQUEST[&#39;rows&#39;];<br />&#160;&#160;&#160; $sidx&#160; = $_REQUEST[&#39;sidx&#39;];<br />&#160;&#160;&#160; $sord&#160; = $_REQUEST[&#39;sord&#39;]; </p>
<p>&#160;&#160;&#160; // Search parameters<br />&#160;&#160;&#160; $ssql&#160; = &#8220;&#8221;;&#160; // Null out the SQL conditional string<br />&#160;&#160;&#160; $sdata = $_GET[&#39;searchString&#39;];&#160; // Reserved variable<br />&#160;&#160;&#160; $soper = $_GET[&#39;searchOper&#39;];&#160;&#160;&#160; // Also reserved<br />&#160;&#160;&#160; $sfld&#160; = $_GET[&#39;searchField&#39;];&#160;&#160; // Ditto</p>
<p>&#160;&#160;&#160; if ($sfld != &#8220;&#8221;) {&#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; $ssql .= $sfld;<br />&#160;&#160;&#160; &#160;&#160;&#160; // Case statement for search identifiers<br />&#160;&#160;&#160; &#160;&#160;&#160; switch ($soper) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;bw&#8221;: $sdata .= &#8220;%&#8221;; $ssql .= &#8221; LIKE &#39;&#8221; . $sdata . &#8220;&#39;&#8221;; break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;eq&#8221;: if (is_numeric($sdata)) {$ssql .= &#8221; = &#8221; . $sdata;} else {$ssql .= &#8221; = &#39;&#8221; . $sdata.&#8221;&#39;&#8221;;} break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;ne&#8221;: if (is_numeric($sdata)) {$ssql .= &#8221; &#60;&#62; &#8221; . $sdata;} else {$ssql .= &#8221; &#60;&#62; &#39;&#8221; . $sdata . &#8220;&#39;&#8221;;} break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;lt&#8221;: if (is_numeric($sdata)) {$ssql .= &#8221; &#60; &#8221; . $sdata;} else {$ssql .= &#8221; &#60; &#39;&#8221; . $sdata . &#8220;&#39;&#8221;;} break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;le&#8221;: if (is_numeric($sdata)) {$ssql .= &#8221; &#60;= &#8221; . $sdata;} else {$ssql .= &#8221; &#60;= &#39;&#8221; . $sdata . &#8220;&#39;&#8221;;} break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;gt&#8221;: if (is_numeric($sdata)) {$ssql .= &#8221; &#62; &#8221; . $sdata;} else {$ssql .= &#8221; &#62; &#39;&#8221; . $sdata.&#8221;&#39;&#8221;;} break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;ge&#8221;: if (is_numeric($sdata)) {$ssql .= &#8221; &#62;= &#8221; . $sdata;} else {$ssql .= &#8221; &#62;= &#39;&#8221; . $sdata.&#8221;&#39;&#8221;;} break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; case &#8220;ew&#8221;: $ssql .= &#8221; LIKE &#39;%&#8221; . $sdata . &#8220;&#39;&#8221;; break;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; default: $ssql = &#8220;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; }&#160;&#160;&#160; <br />&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; $db = mysql_connect($dbhost,$dbuser,$dbpassword)<br />&#160;&#160;&#160; or die(&#8221;Connection Error: &#8221; . mysql_error());<br />&#160;&#160;&#160; mysql_select_db($database) or die(&#8221;Error conecting to db.&#8221;);<br />&#160;&#160;&#160; $result = mysql_query(&#8221;SELECT COUNT(*) AS count FROM imsim&#8221;); <br />&#160;&#160;&#160; $row = mysql_fetch_array($result,MYSQL_ASSOC); <br />&#160;&#160;&#160; $count = $row[&#39;count&#39;]; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; if( $count &#62; 0 ) { <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; $total_pages = ceil($count/$limit); <br />&#160;&#160;&#160; } else { <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; $total_pages = 0; <br />&#160;&#160;&#160; } <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; if ($page &#62; $total_pages) {$page = $total_pages;}<br />&#160;&#160;&#160; $start = $limit * $page - $limit;<br />&#160;&#160;&#160; if($start &#60; 0) {$start = 0;} <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; // Once more into the breach, dear friends<br />&#160;&#160;&#160; $ser = &#8220;SELECT * FROM imsim WHERE $ssql&#8221;;<br />&#160;&#160;&#160; $result = mysql_query($ser) or die(&#8221;Couldn&#39;t execute query.&#8221;.mysql_error()); <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; // XML header<br />&#160;&#160;&#160; if (stristr($_SERVER["HTTP_ACCEPT"],&#8221;application/xhtml+xml&#8221;)) {<br />&#160;&#160;&#160; &#160; header(&#8221;Content-type: application/xhtml+xml;charset=utf-8&#8243;); <br />&#160;&#160;&#160; } else {<br />&#160;&#160;&#160; &#160; header(&#8221;Content-type: text/xml;charset=utf-8&#8243;);<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; echo &#8220;&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;rows&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;page&#62;&#8221; . $page . &#8220;&#60;/page&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;total&#62;&#8221; . $total_pages . &#8220;&#60;/total&#62;&#8221;;<br />&#160;&#160;&#160; echo &#8220;&#60;records&#62;&#8221; . $count . &#8220;&#60;/records&#62;&#8221;;<br />&#160;&#160;&#160; <br />&#160;&#160;&#160; // Put text data in CDATA tags<br />&#160;&#160;&#160; while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;row id=&#39;&#8221;. $row[iid].&#8221;&#39;&#62;&#8221;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[iid] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[code] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[price] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[active] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[itemcd] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[buycde] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[odate] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[idate] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[cost] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[lstcost] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[stdcost] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtyonh] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtyall] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#60;![CDATA[" . $row[descr1] . &#8220;]]&#62;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#60;![CDATA[" . $row[descr2] . &#8220;]]&#62;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtybo] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[qtyono] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[unitms] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[binloc] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[reord] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[lcntdat] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[catg] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[weight] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#8221; . $row[taxflag] . &#8220;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;cell&#62;&#60;![CDATA[" . $row[note] . &#8220;]]&#62;&#60;/cell&#62;&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; echo &#8220;&#60;/row&#62;&#8221;;<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; echo &#8220;&#60;/rows&#62;&#8221;; </p>
<p>// ADD RECORD<br />} elseif($_POST[&#39;oper&#39;]==&#39;add&#39;) {</p>
<p>&#160;&#160;&#160; // GENERATE ADD QUERY<br />&#160;&#160;&#160; $new_post = $_POST;<br />&#160;&#160;&#160; foreach ($_POST as $k=&#62;$v) {<br />&#160;&#160;&#160; &#160;&#160;&#160; if (($k != &#39;oper&#39;) &#38;&#38; ($k != &#39;id&#39;)) { // Eliminate the JQG parameters<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $fieldnames&#160; .= $k . &#8220;,&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $fieldvalues .= &#8220;&#39;&#8221; . $v . &#8220;&#39;,&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; $fieldnames&#160; = substr($fieldnames,0,-1);&#160;&#160;&#160; <br />&#160;&#160;&#160; $fieldvalues = substr($fieldvalues,0,-1);</p>
<p>&#160;&#160;&#160; $db = mysql_connect($dbhost, $dbuser, $dbpassword)<br />&#160;&#160;&#160; or die(&#8221;Connection Error: &#8221; . mysql_error());<br />&#160;&#160;&#160; mysql_select_db($database) or die(&#8221;DB connection FAILED!&#8221;);<br />&#160;&#160;&#160; echo $ins = &#8220;INSERT INTO invheader ($fieldnames) VALUES ($fieldvalues)&#8221;;<br />&#160;&#160;&#160; @mysql_query($ins) or die(&#8221;Add has died.&#8221;);</p>
<p>// EDIT RECORD<br />} elseif($_POST[&#39;oper&#39;]==&#39;edit&#39;) {</p>
<p>&#160;&#160;&#160; // GENERATE EDIT QUERY<br />&#160;&#160;&#160; $new_post = $_POST;<br />&#160;&#160;&#160; foreach ($_POST as $k=&#62;$v) {<br />&#160;&#160;&#160; &#160;&#160;&#160; if (($k != &#39;oper&#39;) &#38;&#38; ($k != &#39;id&#39;)) { // Eliminate the JQG parameters<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $fieldquery .= $k . &#8220;=&#39;&#8221; . $v . &#8220;&#39;,&#8221;;<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; $fieldquery = substr($fieldquery,0,-1);&#160;&#160;&#160; </p>
<p>&#160;&#160;&#160; $db = mysql_connect($dbhost, $dbuser, $dbpassword)<br />&#160;&#160;&#160; or die(&#8221;Connection Error: &#8221; . mysql_error());<br />&#160;&#160;&#160; mysql_select_db($database) or die(&#8221;DB connection FAILED!&#8221;);<br />&#160;&#160;&#160; $upd = &#8220;UPDATE invheader SET $fieldquery WHERE id=&#39;&#8221; . $_POST[&#39;id&#39;] . &#8220;&#39;&#8221;;<br />&#160;&#160;&#160; @mysql_query($upd) or die(&#8221;Edit has died.&#8221;);</p>
<p>// DELETE RECORD<br />} elseif($_POST[&#39;oper&#39;]==&#39;del&#39;) {<br />&#160;&#160;&#160; $id = $_POST[&#39;id&#39;];</p>
<p>&#160;&#160;&#160; $db = mysql_connect($dbhost, $dbuser, $dbpassword)<br />&#160;&#160;&#160; or die(&#8221;Connection Error: &#8221; . mysql_error());<br />&#160;&#160;&#160; mysql_select_db($database) or die(&#8221;DB connection FAILED!&#8221;);<br />&#160;&#160;&#160; $SQL = &#8220;DELETE FROM invheader WHERE id=$id&#8221;;<br />&#160;&#160;&#160; $res = @mysql_query($SQL) or die(&#8221;Delete has died.&#8221;);<br />}<br />?&#62;</p>
</div>
</div>
]]></description>
        	        	<pubDate>Tue, 28 Apr 2009 12:43:47 +0300</pubDate>
        </item>
</channel>
</rss>