<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Drag and Drop Reordering of Database fields with Scriptaculous.</title>
	<atom:link href="http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/</link>
	<description>Tim Roberts CakePHP, MySQL and jQuery Developer</description>
	<lastBuildDate>Fri, 03 Feb 2012 01:34:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: LWF</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-5695</link>
		<dc:creator>LWF</dc:creator>
		<pubDate>Fri, 30 Apr 2010 17:22:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-5695</guid>
		<description>ASP:
on the AJAX page.....

Dim myString, myArray
myString = Request(&quot;item_list[]&quot;) &#039;get the string/list by Request
myArray = Split(myString, &quot;,&quot;) &#039;split the string at commas and put in array
	
For i=0 to UBound(myArray)
objConn.Execute(&quot;UPDATE TABLE SET [Position]=&quot;&amp;(i+1)&amp;&quot; WHERE ID=&quot;&amp;trim(myArray(i))) &#039;update record
Next

HTH

TW</description>
		<content:encoded><![CDATA[<p>ASP:<br />
on the AJAX page&#8230;..</p>
<p>Dim myString, myArray<br />
myString = Request(&#8220;item_list[]&#8220;) &#8216;get the string/list by Request<br />
myArray = Split(myString, &#8220;,&#8221;) &#8216;split the string at commas and put in array</p>
<p>For i=0 to UBound(myArray)<br />
objConn.Execute(&#8220;UPDATE TABLE SET [Position]=&#8221;&amp;(i+1)&amp;&#8221; WHERE ID=&#8221;&amp;trim(myArray(i))) &#8216;update record<br />
Next</p>
<p>HTH</p>
<p>TW</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-5665</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Tue, 02 Mar 2010 21:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-5665</guid>
		<description>sorry about that, ignore my code above, this comment thing got rid of a lot of it for some reason so the code above is not what i have.</description>
		<content:encoded><![CDATA[<p>sorry about that, ignore my code above, this comment thing got rid of a lot of it for some reason so the code above is not what i have.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-5664</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Tue, 02 Mar 2010 21:49:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-5664</guid>
		<description>Is there a way to include a php file from elsewhere within the requested file?? I’m trying to set this up but include my database connection file so I don’t have to write out the connection details more then once.

a standard php include doesn’t work?

This is my script:

$value) {
mysql_query(&quot;UPDATE items SET position=&#039;&quot;.$i.&quot;&#039; WHERE id =&#039;&quot;.$value.&quot;&#039;&quot;);
$i++;
}
?&gt;</description>
		<content:encoded><![CDATA[<p>Is there a way to include a php file from elsewhere within the requested file?? I’m trying to set this up but include my database connection file so I don’t have to write out the connection details more then once.</p>
<p>a standard php include doesn’t work?</p>
<p>This is my script:</p>
<p>$value) {<br />
mysql_query(&#8220;UPDATE items SET position=&#8217;&#8221;.$i.&#8221;&#8216; WHERE id =&#8217;&#8221;.$value.&#8221;&#8216;&#8221;);<br />
$i++;<br />
}<br />
?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-5663</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Tue, 02 Mar 2010 21:47:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-5663</guid>
		<description>Is there a way to include a php file from elsewhere within the requested file?? I&#039;m trying to set this up but include my database connection file so I don&#039;t have to write out the connection details more then once.

a standard php include doesn&#039;t work?</description>
		<content:encoded><![CDATA[<p>Is there a way to include a php file from elsewhere within the requested file?? I&#8217;m trying to set this up but include my database connection file so I don&#8217;t have to write out the connection details more then once.</p>
<p>a standard php include doesn&#8217;t work?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: omegadev</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-3933</link>
		<dc:creator>omegadev</dc:creator>
		<pubDate>Sat, 06 Jun 2009 17:58:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-3933</guid>
		<description>thanks for the script above...i got the drag and drop function to implement perfectly but i don&#039;t think its sending anything to my php page to update the information in the database....here&#039;s my script in the html


                                   	 		
											&lt;li id=&quot;item_&quot;&gt;.&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
                                       	
                                    
                                    
                                    
									
										function updateOrder()
										{
											var options = 
											{
												method : &#039;post&#039;,
												parameters : Sortable.serialize(&#039;myList&#039;)
											};
											new Ajax.Request(&#039;reordermenu.php&#039;, options);												
										}
                                      Sortable.create(&#039;myList&#039;,{ghosting:false,constraint:true,hoverclass:&#039;over&#039;,
                                        onChange:function(element)
										{										
                                            var totElement = ;
                                            var newOrder = Sortable.serialize(element.parentNode);
                                            for(i=1; i&lt;=totElement; i++)
											{
                                                newOrder = newOrder.replace(&quot;myList[]=&quot;,&quot;&quot;);
                                                newOrder = newOrder.replace(&quot;&amp;&quot;,&quot;,&quot;);
                                            }
                                            $(&#039;myList_serialize&#039;).innerHTML = &#039;&lt;strong&gt;New Order&lt;/strong&gt;: &#039;+newOrder;
											$(&#039;newOrderInput&#039;).value = newOrder;
                                        },
										onUpdate:updateOrder});
                                    
 and here&#039;s my script in the php page...

$value) 
	{
    	$updateSQL = sprintf(&quot;UPDATE menu_main SET position=&#039;&quot;.$i.&quot;&#039; WHERE menuid =&#039;&quot;.$value.&quot;&#039;&quot;);
		$results = mysql_query($updateSQL, $con) or die(mysql_error()); 
		$i++;
	}
	mysql_close($con);
?&gt;

what am I doing wrong???</description>
		<content:encoded><![CDATA[<p>thanks for the script above&#8230;i got the drag and drop function to implement perfectly but i don&#8217;t think its sending anything to my php page to update the information in the database&#8230;.here&#8217;s my script in the html</p>
<p>											&lt;li id=&#8221;item_&#8221;&gt;.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>										function updateOrder()<br />
										{<br />
											var options =<br />
											{<br />
												method : &#8216;post&#8217;,<br />
												parameters : Sortable.serialize(&#8216;myList&#8217;)<br />
											};<br />
											new Ajax.Request(&#8216;reordermenu.php&#8217;, options);<br />
										}<br />
                                      Sortable.create(&#8216;myList&#8217;,{ghosting:false,constraint:true,hoverclass:&#8217;over&#8217;,<br />
                                        onChange:function(element)<br />
										{<br />
                                            var totElement = ;<br />
                                            var newOrder = Sortable.serialize(element.parentNode);<br />
                                            for(i=1; i&lt;=totElement; i++)<br />
											{<br />
                                                newOrder = newOrder.replace(&#8220;myList[]=&#8221;,&#8221;");<br />
                                                newOrder = newOrder.replace(&#8220;&amp;&#8221;,&#8221;,&#8221;);<br />
                                            }<br />
                                            $(&#8216;myList_serialize&#8217;).innerHTML = &#8216;<strong>New Order</strong>: &#8216;+newOrder;<br />
											$(&#8216;newOrderInput&#8217;).value = newOrder;<br />
                                        },<br />
										onUpdate:updateOrder});</p>
<p> and here&#8217;s my script in the php page&#8230;</p>
<p>$value)<br />
	{<br />
    	$updateSQL = sprintf(&#8220;UPDATE menu_main SET position=&#8217;&#8221;.$i.&#8221;&#8216; WHERE menuid =&#8217;&#8221;.$value.&#8221;&#8216;&#8221;);<br />
		$results = mysql_query($updateSQL, $con) or die(mysql_error());<br />
		$i++;<br />
	}<br />
	mysql_close($con);<br />
?&gt;</p>
<p>what am I doing wrong???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-2268</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 22 Apr 2009 09:58:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-2268</guid>
		<description>Problem solved just the name of the db table...call me dummy!!</description>
		<content:encoded><![CDATA[<p>Problem solved just the name of the db table&#8230;call me dummy!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-2267</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 22 Apr 2009 09:56:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-2267</guid>
		<description>Don&#039;t call me dummy...that&#039;s the final one

 
	
	
		Nicola
	
		Barbara
	
		Maria
	
		Ada
	
		Giovanni
	
		Paolo
	
		Gennaro
	
		Rossella
	

function updateOrder(){
var options = {
method : &#039;post&#039;,
parameters : Sortable.serialize(&#039;item_list&#039;)
};
new Ajax.Request(&#039;server_items_reorder.php&#039;, options);
}

Sortable.create(&#039;item_list&#039;, {constraint:&#039;vertical&#039;, onUpdate:updateOrder});
		
</description>
		<content:encoded><![CDATA[<p>Don&#8217;t call me dummy&#8230;that&#8217;s the final one</p>
<p>		Nicola</p>
<p>		Barbara</p>
<p>		Maria</p>
<p>		Ada</p>
<p>		Giovanni</p>
<p>		Paolo</p>
<p>		Gennaro</p>
<p>		Rossella</p>
<p>function updateOrder(){<br />
var options = {<br />
method : &#8216;post&#8217;,<br />
parameters : Sortable.serialize(&#8216;item_list&#8217;)<br />
};<br />
new Ajax.Request(&#8216;server_items_reorder.php&#8217;, options);<br />
}</p>
<p>Sortable.create(&#8216;item_list&#8217;, {constraint:&#8217;vertical&#8217;, onUpdate:updateOrder});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-2266</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 22 Apr 2009 09:55:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-2266</guid>
		<description>My code clearer ..sorry 

	
	
		Nicola
	
		Barbara
	
		Maria
	
		Ada
	
		Giovanni
	
		Paolo
	
		Gennaro
	
		Rossella
	

function updateOrder(){
var options = {
method : &#039;post&#039;,
parameters : Sortable.serialize(&#039;item_list&#039;)
};
new Ajax.Request(&#039;server_items_reordersasaasa.php&#039;, options);
}

Sortable.create(&#039;item_list&#039;, {constraint:&#039;vertical&#039;, onUpdate:updateOrder});
		
</description>
		<content:encoded><![CDATA[<p>My code clearer ..sorry </p>
<p>		Nicola</p>
<p>		Barbara</p>
<p>		Maria</p>
<p>		Ada</p>
<p>		Giovanni</p>
<p>		Paolo</p>
<p>		Gennaro</p>
<p>		Rossella</p>
<p>function updateOrder(){<br />
var options = {<br />
method : &#8216;post&#8217;,<br />
parameters : Sortable.serialize(&#8216;item_list&#8217;)<br />
};<br />
new Ajax.Request(&#8216;server_items_reordersasaasa.php&#8217;, options);<br />
}</p>
<p>Sortable.create(&#8216;item_list&#8217;, {constraint:&#8217;vertical&#8217;, onUpdate:updateOrder});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-2265</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 22 Apr 2009 09:52:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-2265</guid>
		<description>Hi, this is my code





Untitled Document






	
	
		&lt;li id=&quot;item_&quot; style=&quot;cursor:move&quot;&gt;

	

function updateOrder(){
var options = {
method : &#039;post&#039;,
parameters : Sortable.serialize(&#039;item_list&#039;)
};
new Ajax.Request(&#039;server_items_reorder.php&#039;, options);
}

Sortable.create(&#039;item_list&#039;, {constraint:&#039;vertical&#039;, onUpdate:updateOrder});
		




This is my php code

// ADD YOUR DATABASE CONNECTION PARAMETERS HERE!!!
	include (&quot;connect.inc.php&quot;);
$i=1;
foreach($_POST[&#039;item_list&#039;] as $key=&gt;$value) {
mysql_query(&quot;UPDATE items SET position=&#039;&quot;.$i.&quot;&#039; WHERE id =&#039;&quot;.$value.&quot;&#039;&quot;) or die(&quot;UPDATE items SET position=&#039;&quot;.$i.&quot;&#039; WHERE id =&#039;&quot;.$value.&quot;&#039;&quot;);
$i++;
}

The problem I have is that the updateOrder function does not fire the php script. The table in fact doesn&#039;t update. I have checked the code time and time but cannot see any mistakes...

Can you help me...? 
Thanks a lot in advance</description>
		<content:encoded><![CDATA[<p>Hi, this is my code</p>
<p>Untitled Document</p>
<p>		&lt;li id=&#8221;item_&#8221; style=&#8221;cursor:move&#8221;&gt;</p>
<p>function updateOrder(){<br />
var options = {<br />
method : &#8216;post&#8217;,<br />
parameters : Sortable.serialize(&#8216;item_list&#8217;)<br />
};<br />
new Ajax.Request(&#8216;server_items_reorder.php&#8217;, options);<br />
}</p>
<p>Sortable.create(&#8216;item_list&#8217;, {constraint:&#8217;vertical&#8217;, onUpdate:updateOrder});</p>
<p>This is my php code</p>
<p>// ADD YOUR DATABASE CONNECTION PARAMETERS HERE!!!<br />
	include (&#8220;connect.inc.php&#8221;);<br />
$i=1;<br />
foreach($_POST['item_list'] as $key=&gt;$value) {<br />
mysql_query(&#8220;UPDATE items SET position=&#8217;&#8221;.$i.&#8221;&#8216; WHERE id =&#8217;&#8221;.$value.&#8221;&#8216;&#8221;) or die(&#8220;UPDATE items SET position=&#8217;&#8221;.$i.&#8221;&#8216; WHERE id =&#8217;&#8221;.$value.&#8221;&#8216;&#8221;);<br />
$i++;<br />
}</p>
<p>The problem I have is that the updateOrder function does not fire the php script. The table in fact doesn&#8217;t update. I have checked the code time and time but cannot see any mistakes&#8230;</p>
<p>Can you help me&#8230;?<br />
Thanks a lot in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.wiseguysonly.com/2006/08/11/drag-and-drop-reordering-of-database-fields-with-ajax/comment-page-1/#comment-1162</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Wed, 18 Mar 2009 16:04:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=114#comment-1162</guid>
		<description>Solved that problem. But I&#039;ve got another quick question.

I&#039;ve added a save button and moved the function that calls the reorder script to the onclick event for that button.

I&#039;ve also added a reset button. which currently works by simply refreshing the page. - onClick=&quot;location.reload(true)&quot;

However, there must be a way to reset the item order to how it was when the page first loaded without having to reload the whole page again?

Any idea how to do it?</description>
		<content:encoded><![CDATA[<p>Solved that problem. But I&#8217;ve got another quick question.</p>
<p>I&#8217;ve added a save button and moved the function that calls the reorder script to the onclick event for that button.</p>
<p>I&#8217;ve also added a reset button. which currently works by simply refreshing the page. &#8211; onClick=&#8221;location.reload(true)&#8221;</p>
<p>However, there must be a way to reset the item order to how it was when the page first loaded without having to reload the whole page again?</p>
<p>Any idea how to do it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

