<?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/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Editable Content Using MooTools 1.2, PHP, and&#160;MySQL</title> <atom:link href="http://davidwalsh.name/editable-content-mootools-php-mysql/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/editable-content-mootools-php-mysql</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Thu, 09 Feb 2012 15:40:33 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3</generator> <item><title>By: Raja</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-27306</link> <dc:creator>Raja</dc:creator> <pubDate>Thu, 20 Oct 2011 02:45:20 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-27306</guid> <description>This was easy to implement. Thanks for the post.</description> <content:encoded><![CDATA[<p>This was easy to implement. Thanks for the post.</p> ]]></content:encoded> </item> <item><title>By: afro360</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-23692</link> <dc:creator>afro360</dc:creator> <pubDate>Sat, 23 Apr 2011 21:25:05 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-23692</guid> <description>Would be nice to see nicedit inline edit used.</description> <content:encoded><![CDATA[<p>Would be nice to see nicedit inline edit used.</p> ]]></content:encoded> </item> <item><title>By: tarik</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-21489</link> <dc:creator>tarik</dc:creator> <pubDate>Thu, 02 Dec 2010 19:14:53 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-21489</guid> <description>simply perfect!</description> <content:encoded><![CDATA[<p>simply perfect!</p> ]]></content:encoded> </item> <item><title>By: Elwood</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-21259</link> <dc:creator>Elwood</dc:creator> <pubDate>Tue, 09 Nov 2010 16:32:17 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-21259</guid> <description>Hello !I&#039;ve found a bug in your script. If you double-click on a text and you double-click again, the input value is &lt; input type=&quot;text&quot;....An idea for block this action ?</description> <content:encoded><![CDATA[<p>Hello !</p><p>I&#8217;ve found a bug in your script. If you double-click on a text and you double-click again, the input value is &lt; input type=&quot;text&quot;&#8230;.</p><p>An idea for block this action ?</p> ]]></content:encoded> </item> <item><title>By: pSouper</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-19756</link> <dc:creator>pSouper</dc:creator> <pubDate>Mon, 06 Sep 2010 19:55:12 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-19756</guid> <description>Hi David,
Thanks for the hard work on this, would/could it be able to tackle drop-down lists too?cheers,</description> <content:encoded><![CDATA[<p>Hi David,<br
/> Thanks for the hard work on this, would/could it be able to tackle drop-down lists too?</p><p>cheers,</p> ]]></content:encoded> </item> <item><title>By: Jade</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-19560</link> <dc:creator>Jade</dc:creator> <pubDate>Fri, 27 Aug 2010 08:28:53 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-19560</guid> <description>Hi this is my code&lt;code&gt;
$home_query = &quot;SELECT page_ID, page_name, page_content FROM tbl_pages WHERE page_name = &#039;home&#039;&quot;;if(isset($_SESSION[&#039;login_name&#039;]) &amp;&amp; is_numeric($_POST[&#039;id&#039;]) &amp;&amp; isset($_POST[&#039;content&#039;]))
{
$query = &quot;UPDATE tbl_pages SET page_content = &#039;&quot;.mysql_real_escape_string(stripslashes($_POST[&#039;content&#039;])).&quot;&#039; WHERE page_ID = &quot;.(int)$_POST[&#039;id&#039;];
$result = mysql_query($query,$db_link);
}
$home_result = mysql_query ($home_query);
$row = mysql_fetch_array ($home_result, MYSQL_ASSOC);
if(isset($_SESSION[&#039;login_name&#039;]))
{
echo &#039;
&#039;.&quot;{$row[&#039;page_content&#039;]}&quot;.&#039;
&#039;;
}else{
echo &#039;
&#039;.&quot;{$row[&#039;page_content&#039;]}&quot;.&#039;
&#039;;
}?&gt;
&lt;/code&gt;I cant get my database to update any suggestions?Cheers,</description> <content:encoded><![CDATA[<p>Hi this is my code</p><p><code><br
/> $home_query = "SELECT page_ID, page_name, page_content FROM tbl_pages WHERE page_name = 'home'";</p><p>if(isset($_SESSION['login_name']) &amp;&amp; is_numeric($_POST['id']) &amp;&amp; isset($_POST['content']))<br
/> {<br
/> $query = "UPDATE tbl_pages SET page_content = '".mysql_real_escape_string(stripslashes($_POST['content']))."' WHERE page_ID = ".(int)$_POST['id'];<br
/> $result = mysql_query($query,$db_link);<br
/> }</p><p>$home_result = mysql_query ($home_query);<br
/> $row = mysql_fetch_array ($home_result, MYSQL_ASSOC);<br
/> if(isset($_SESSION['login_name']))<br
/> {<br
/> echo '</p><p> '."{$row['page_content']}".'<br
/> ';<br
/> }else{<br
/> echo '<br
/> '."{$row['page_content']}".'<br
/> ';<br
/> }?&gt;<br
/> </code></p><p>I cant get my database to update any suggestions?</p><p>Cheers,</p> ]]></content:encoded> </item> <item><title>By: Arnar G</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-17680</link> <dc:creator>Arnar G</dc:creator> <pubDate>Tue, 18 May 2010 18:51:57 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-17680</guid> <description>This example works out great, I edited it a bit to implement into my CMS.I wrote a custom PHP script that passes on more variables seperated by a - to declare to the php what it is supposed to update.That way this code can very easily be implemented into any application.I also disabled the Alert notify since I prefer not to get that window popping up everytime I edit my site.</description> <content:encoded><![CDATA[<p>This example works out great, I edited it a bit to implement into my CMS.</p><p>I wrote a custom PHP script that passes on more variables seperated by a &#8211; to declare to the php what it is supposed to update.</p><p>That way this code can very easily be implemented into any application.</p><p>I also disabled the Alert notify since I prefer not to get that window popping up everytime I edit my site.</p> ]]></content:encoded> </item> <item><title>By: Doug McDonald</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-17615</link> <dc:creator>Doug McDonald</dc:creator> <pubDate>Fri, 14 May 2010 23:41:21 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-17615</guid> <description>Hi there, am I missing something regarding ajax calls to a php page? using the above example I&#039;ve removed all the conditional bits regarding $_post requirements but my pages don&#039;t seem to reflect any alteration when the ajax event is fired.it&#039;s clearly getting as far as the js alert, but using a slightly dumbed down php/mysql example as per this example i don&#039;t seem to even get into the code block when either including the php in the page itself, or firing the Reqest() to a different page.Any chance you could offer a tiny touch more explanation on the interaction between mootools and php/mysql? or am I just being a lemon! :P</description> <content:encoded><![CDATA[<p>Hi there, am I missing something regarding ajax calls to a php page? using the above example I&#8217;ve removed all the conditional bits regarding $_post requirements but my pages don&#8217;t seem to reflect any alteration when the ajax event is fired.</p><p>it&#8217;s clearly getting as far as the js alert, but using a slightly dumbed down php/mysql example as per this example i don&#8217;t seem to even get into the code block when either including the php in the page itself, or firing the Reqest() to a different page.</p><p>Any chance you could offer a tiny touch more explanation on the interaction between mootools and php/mysql? or am I just being a lemon! :P</p> ]]></content:encoded> </item> <item><title>By: jon</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-16757</link> <dc:creator>jon</dc:creator> <pubDate>Sat, 03 Apr 2010 13:22:48 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-16757</guid> <description>Is there anyway to add passowrd protection? I want to use this on a webpage for a gig list but boviously only want the club owner to be able to change it.Regards</description> <content:encoded><![CDATA[<p>Is there anyway to add passowrd protection? I want to use this on a webpage for a gig list but boviously only want the club owner to be able to change it.</p><p>Regards</p> ]]></content:encoded> </item> <item><title>By: Hadrien</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-1#comment-13027</link> <dc:creator>Hadrien</dc:creator> <pubDate>Wed, 28 Oct 2009 18:27:53 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-13027</guid> <description>@Hadrien:Found !
I don&#039;t know how but it works well now :) I have also put a check if leaving with empty value//once the dom is ready
window.addEvent(&#039;domready&#039;, function() {
//find the editable$$(&#039;.editable&#039;).each(function(el) {//add double-click and blur events
el.addEvent(&#039;dblclick&#039;,function() {
el.removeClass(&#039;editable&#039;);
//store &quot;before&quot; message
var before = el.get(&#039;text&#039;).trim();
var before2 = el.get(&#039;id&#039;).trim();
//erase current
el.set(&#039;html&#039;,&#039;&#039;);
//replace current text/content with input or textarea element
if(el.hasClass(&#039;textarea&#039;))
{
var input = new Element(&#039;textarea&#039;, { &#039;class&#039;:&#039;box&#039;, &#039;text&#039;:before });
}
else
{
var input = new Element(&#039;input&#039;, { &#039;class&#039;:&#039;box&#039;, &#039;value&#039;:before });
//blur input when they press &quot;Enter&quot;
input.addEvent(&#039;keydown&#039;, function(e) { if(e.key == &#039;enter&#039;) { this.fireEvent(&#039;blur&#039;); } });
}
input.inject(el).select();
//add blur event to input
input.addEvent(&#039;blur&#039;, function() {
//get value, place it in original element
val = input.get(&#039;value&#039;).trim();var iWhere = val.indexOf(&#039; -1) {
el.set(&#039;text&#039;,before);
} else {
if(val==&#039;&#039;) {
el.set(&#039;text&#039;,before2);
} else {
el.set(&#039;text&#039;,val);
}
}
//save respective record
var url = &#039;ajax/saveCompetence.php?id=&#039; + el.get(&#039;rel&#039;) + &#039;&amp;content=&#039; + el.get(&#039;text&#039;);
var request = new Request({
url:url,
method:&#039;post&#039;
}).send();
});
});
});
});</description> <content:encoded><![CDATA[<p>@Hadrien:</p><p>Found !<br
/> I don&#8217;t know how but it works well now :) I have also put a check if leaving with empty value</p><p>//once the dom is ready<br
/> window.addEvent(&#8216;domready&#8217;, function() {<br
/> //find the editable</p><p> $$(&#8216;.editable&#8217;).each(function(el) {</p><p> //add double-click and blur events<br
/> el.addEvent(&#8216;dblclick&#8217;,function() {<br
/> el.removeClass(&#8216;editable&#8217;);</p><p> //store &#8220;before&#8221; message<br
/> var before = el.get(&#8216;text&#8217;).trim();<br
/> var before2 = el.get(&#8216;id&#8217;).trim();<br
/> //erase current<br
/> el.set(&#8216;html&#8217;,&#8221;);<br
/> //replace current text/content with input or textarea element<br
/> if(el.hasClass(&#8216;textarea&#8217;))<br
/> {<br
/> var input = new Element(&#8216;textarea&#8217;, { &#8216;class&#8217;:'box&#8217;, &#8216;text&#8217;:before });<br
/> }<br
/> else<br
/> {<br
/> var input = new Element(&#8216;input&#8217;, { &#8216;class&#8217;:'box&#8217;, &#8216;value&#8217;:before });<br
/> //blur input when they press &#8220;Enter&#8221;<br
/> input.addEvent(&#8216;keydown&#8217;, function(e) { if(e.key == &#8216;enter&#8217;) { this.fireEvent(&#8216;blur&#8217;); } });<br
/> }<br
/> input.inject(el).select();<br
/> //add blur event to input<br
/> input.addEvent(&#8216;blur&#8217;, function() {<br
/> //get value, place it in original element<br
/> val = input.get(&#8216;value&#8217;).trim();</p><p> var iWhere = val.indexOf(&#8216; -1) {<br
/> el.set(&#8216;text&#8217;,before);<br
/> } else {<br
/> if(val==&#8221;) {<br
/> el.set(&#8216;text&#8217;,before2);<br
/> } else {<br
/> el.set(&#8216;text&#8217;,val);<br
/> }<br
/> }</p><p> //save respective record<br
/> var url = &#8216;ajax/saveCompetence.php?id=&#8217; + el.get(&#8216;rel&#8217;) + &#8216;&amp;content=&#8217; + el.get(&#8216;text&#8217;);<br
/> var request = new Request({<br
/> url:url,<br
/> method:&#8217;post&#8217;<br
/> }).send();<br
/> });<br
/> });<br
/> });<br
/> });</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 1/17 queries in 0.016 seconds using disk: basic
Object Caching 865/866 objects using disk: basic

Served from: davidwalsh.name @ 2012-02-09 11:20:55 -->
