<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2336789181658789034</id><updated>2024-10-06T23:23:06.651-07:00</updated><category term="php"/><category term="php help"/><category term="javascript"/><category term="javascript help"/><category term="php security"/><category term="jquery"/><category term="jquery help"/><category term="htaccess"/><category term="mysql"/><category term="javascript validation"/><category term="download"/><category term="jquery validation"/><category term="tutorials"/><category term="javascript functions"/><category term="mysql help"/><category term="Tutorial Links"/><category term="file operations"/><category term="free download"/><category term="PHP Interview Questions"/><category term="birthday"/><category term="curl functions in php"/><category term="greeting cards"/><category term="personal wishes"/><category term="apache"/><category term="birthday images"/><category term="curl functions"/><category term="happy birthday"/><category term="telugu songs"/><category term="wishes"/><category term="ajax"/><category term="api for twitter"/><category term="browser"/><category term="chat application"/><category term="ckeditor"/><category term="client side scripting"/><category term="css"/><category term="css help"/><category term="download epic"/><category term="epic"/><category term="friendship cards"/><category term="friendship day"/><category term="generating tinyurl"/><category term="gmail chat"/><category term="joomla"/><category term="linux"/><category term="mp3songs"/><category term="multiple language"/><category term="new year"/><category term="new year wishes"/><category term="open source"/><category term="paypal"/><category term="paypal help"/><category term="paypal integration"/><category term="post to twitter"/><category term="putty"/><category term="raviteja"/><category term="resize image"/><category term="rewrite rules"/><category term="server access"/><category term="shreya"/><category term="songs"/><category term="telugu language"/><category term="tinyurl"/><category term="twitter"/><category term="unix commands"/><category term="utf8"/><category term="validation tips"/><title type='text'>Anil Kumar Buddha&#39;s Blog</title><subtitle type='html'>PHP Tutorial, PHP Help, Javascript Tutorial, Javascript Help, MySQL Tutorial, MySQL Help,Personal Wishes, Images,Download Tutorials,MySQL Downloads,Download Softwares.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>99</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-88665649366880122</id><published>2016-03-05T11:13:00.000-08:00</published><updated>2016-03-05T11:14:52.758-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="multiple language"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql help"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><category scheme="http://www.blogger.com/atom/ns#" term="telugu language"/><category scheme="http://www.blogger.com/atom/ns#" term="utf8"/><title type='text'>Display Other Texts rather then English using PHP MySQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
When we want to display and store the data other than ENGLISH using PHP.&lt;br /&gt;
&lt;br /&gt;
Below is the code used to save and retrieve the data in PHP.&lt;br /&gt;
&lt;br /&gt;
mysql_set_charset(&#39;utf8&#39;,$db_connect);&lt;br /&gt;
&lt;br /&gt;
where $db_connect is the &quot;MySQL Host&quot; connection handler. You can see the example below for the connection handler.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$db_connect = mysql_connect(HOST_NAME,USERNAME,PASSWORD);&lt;br /&gt;
mysql_set_charset(&#39;utf8&#39;,$db_connect);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
By using the above, we can store and retrieve the data in different languages like Telugu, French, Hindi, German and many.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&amp;nbsp;&lt;/b&gt;And also a major note we need to be keep in mind, when we try to retrieve the same UTF-8 converted data using AJAX. We should not use &quot;mysql_set_charset&quot; as AJAX by default sets the content as &quot;UTF-8&quot;&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/88665649366880122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/88665649366880122' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/88665649366880122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/88665649366880122'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2016/03/display-other-texts-rather-then-english.html' title='Display Other Texts rather then English using PHP MySQL'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-5624265726101644215</id><published>2016-02-29T10:46:00.002-08:00</published><updated>2016-02-29T10:46:58.143-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery validation"/><title type='text'>Disable Back Button using Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User tries to use back button for most of the applications and it is valid, but few of the cases is required to disable the back button and also restrict the user.&lt;br /&gt;
&lt;br /&gt;
It would be very useful when the user is on payment page. Below is the code to disable the back button in Browser.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;&quot;&gt;
var currentURL = window.location.pathname + window.location.search;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;&quot;&gt;
&amp;nbsp;history.pushState(null, null, currentURL);&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;&quot;&gt;
&amp;nbsp;window.addEventListener(&#39;&lt;wbr&gt;&lt;/wbr&gt;popstate&#39;, function(event) {&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;&quot;&gt;
&amp;nbsp; history.pushState(null, null, currentURL);&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;&quot;&gt;
&amp;nbsp;});&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.8px;&quot;&gt;
It works in all major browsers&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/5624265726101644215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/5624265726101644215' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5624265726101644215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5624265726101644215'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2016/02/disable-back-button-using-javascript.html' title='Disable Back Button using Javascript'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-2108951178212176268</id><published>2015-07-07T11:42:00.000-07:00</published><updated>2015-07-07T11:44:44.782-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript functions"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><title type='text'>Trigger onchange event manually using Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Below is the code to trigger onchange event for an element using javascript.&lt;br /&gt;
&lt;br /&gt;
Usage of the method can be, when we want to call the onchange event on page loads or on by changing the text box value for other textbox.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if(document.fireEvent) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; document.getElementById(&quot;myElement&quot;).fireEvent(&#39;onchange&#39;);&lt;br /&gt;
} else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; var event = document.createEvent(&quot;HTMLEvents&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; event.initEvent(&quot;change&quot;,true,false);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; document.getElementById(&quot;myElement&quot;).dispatchEvent(event);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Whereas in jQuery, we can simply call the below method.&lt;br /&gt;
&lt;br /&gt;
jQuery(&#39;myElement&#39;).change();&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/2108951178212176268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/2108951178212176268' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2108951178212176268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2108951178212176268'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2015/07/force-onchange-event-manually-using.html' title='Trigger onchange event manually using Javascript'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-7464546564142025593</id><published>2014-07-24T12:11:00.000-07:00</published><updated>2014-07-24T12:11:09.648-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript functions"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery validation"/><title type='text'>Javascript: trim function support in all browsers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
In Javascript, when we want to remove spaces in a string, we would be using trim function which is supported in all major browsers. See below code to use trim function in Javascript.&lt;br /&gt;
&lt;br /&gt;
var str = &quot; &amp;nbsp; &amp;nbsp; message to trim &amp;nbsp; &amp;nbsp;&quot;;&lt;br /&gt;
document.write(str.trim()); &amp;nbsp;// this code will prints as &lt;b&gt;message to trim &lt;/b&gt;in the body.&lt;br /&gt;
&lt;br /&gt;
But the above trim() function doesnot support in IE. To support the same functionality in IE too, add the below code to work as expected.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;if (typeof String.prototype.trim !== &quot;function&quot;) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; String.prototype.trim = function () {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return this.replace(/^\s+|\s+$/g, &quot;&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/7464546564142025593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/7464546564142025593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7464546564142025593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7464546564142025593'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2014/07/javascript-trim-function-support-in-all.html' title='Javascript: trim function support in all browsers'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-6160440444824072017</id><published>2014-05-17T09:01:00.000-07:00</published><updated>2014-05-17T09:01:41.853-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="apache"/><category scheme="http://www.blogger.com/atom/ns#" term="htaccess"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><category scheme="http://www.blogger.com/atom/ns#" term="php security"/><category scheme="http://www.blogger.com/atom/ns#" term="rewrite rules"/><title type='text'>Restrict image access from browser using HTACCESS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;When we want to restrict the image access from the browser other than the page, add the below code in &lt;b&gt;htaccess &lt;/b&gt;file to apply.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;RewriteEngine on&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;RewriteRule \.(gif|jpg|png)$ - [F]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;localhost&lt;/b&gt;&amp;nbsp;need to be replaced by the domain name where the application is hosted.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;NOTE: Above code works in Apache (LINUX) not in windows&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/6160440444824072017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/6160440444824072017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6160440444824072017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6160440444824072017'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2014/05/restrict-image-access-from-browser.html' title='Restrict image access from browser using HTACCESS'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-1444531188157204731</id><published>2014-04-28T10:26:00.000-07:00</published><updated>2014-04-28T10:26:11.707-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="apache"/><category scheme="http://www.blogger.com/atom/ns#" term="htaccess"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><category scheme="http://www.blogger.com/atom/ns#" term="php security"/><title type='text'>Redirect to maintenance page using HTACCESS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Redirecting the whole site to maintenance page using HTACCESS&lt;br /&gt;
&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteBase /&lt;br /&gt;
RewriteCond %{REMOTE_ADDR} !^111\.11\.1\.11&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/maintenance\.html$&lt;br /&gt;
RewriteRule ^(.*)$ http://www.domainname.com/maintenance.html [R=307,L]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Rewrite condition mentioned is to stop the redirection for that particular domain.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;RewriteCond %{REMOTE_ADDR} !^111\.11\.1\.11&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&quot;&lt;b&gt;maintenance.html&lt;/b&gt;&quot; is the page where you want to redirect the website.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/1444531188157204731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/1444531188157204731' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/1444531188157204731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/1444531188157204731'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2014/04/redirect-to-maintenance-page-using.html' title='Redirect to maintenance page using HTACCESS'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-2993833292514071979</id><published>2013-12-01T01:02:00.000-08:00</published><updated>2013-12-01T01:05:52.565-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ckeditor"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery validation"/><title type='text'>Value of CKeditor using Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
To get the value of the CKeditor content using Javascript or jQuery. We need to use the below syntax.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;CKEDITOR.instances[&#39;article_long_desc&#39;].getData().length =&amp;gt; It provides the length of the content in the editor&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;CKEDITOR.instances[&#39;article_long_desc&#39;].getData() =&amp;gt; It retrieves the value of the Textarea&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Where &quot;article_long_desc&quot; is the textarea name&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/2993833292514071979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/2993833292514071979' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2993833292514071979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2993833292514071979'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/12/value-of-ckeditor-using-javascript.html' title='Value of CKeditor using Javascript'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-6900077175117793927</id><published>2013-11-18T08:54:00.002-08:00</published><updated>2013-11-18T08:54:32.479-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Random values from an Array using php</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below is the function to pick random values from an existing array&lt;br /&gt;
&lt;br /&gt;
function &lt;b&gt;array_pick_random&lt;/b&gt;($arr, $number = 1) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; shuffle($arr);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; $r = array();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; for ($i = 0; $i &amp;lt;&amp;nbsp;$number; $i++) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $r[] = $arr[$i];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return&amp;nbsp;$number&amp;nbsp;== 1 ? $r[0] : $r;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
In the above function &#39;$arr&#39; is the Array which we want to get the random values.&lt;br /&gt;
&lt;br /&gt;
&#39;$number&#39; is the number of array elements need to return.&lt;br /&gt;
&lt;br /&gt;
Function returns an array if &#39;$number&#39; contains more than 1.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/6900077175117793927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/6900077175117793927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6900077175117793927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6900077175117793927'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/11/random-values-from-array-using-php.html' title='Random values from an Array using php'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-216803395555005461</id><published>2013-10-20T02:13:00.001-07:00</published><updated>2013-10-20T02:13:41.704-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript functions"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery validation"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><category scheme="http://www.blogger.com/atom/ns#" term="php security"/><title type='text'>ajax with cross domain</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
We may worked with jQuery ajax in many cases but when we try to use jQuery AJAX to get the data from other domain, we need to use &quot;&lt;b&gt;crossDomain&lt;/b&gt;&quot; &amp;amp; set it to true.&lt;br /&gt;
&lt;br /&gt;
Let us consider the basic jQuery AJAX within the domain.&lt;br /&gt;
&lt;br /&gt;
$.ajax({&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; url: &quot;show_users.php&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data: {data1:&quot;val1&quot;, data2=&quot;val2&quot;},&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type:&#39;POST&#39;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; success: function(res)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(&#39;#element_name&#39;).html(res);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; error: function (){alert(&#39;something went wrong&#39;);}&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
Above is the AJAX request within the domain &amp;amp; just we are passing the data to the page &quot;&lt;b&gt;show_users.php&lt;/b&gt;&quot; with two values. As it is simple AJAX request, it works fine.&lt;br /&gt;
&lt;br /&gt;
But when we work with cross domains (i.e. AJAX request to other domain from our domain) we need to rewrite the jQuery AJAX as below.&lt;br /&gt;
&lt;br /&gt;
$.ajax({&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; url: &quot;http://domain.com/show_users.php&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data: {data1:&quot;val1&quot;, data2=&quot;val2&quot;},&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type:&#39;POST&#39;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;crossDomain: true,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; success: function(res)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(&#39;#element_name&#39;).html(res);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; error: function (){alert(&#39;something went wrong&#39;);}&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
We need to use &quot;&lt;b&gt;crossDomain&lt;/b&gt;&quot; &amp;amp; set it to &lt;b&gt;TRUE &lt;/b&gt;&amp;amp; in the &lt;b&gt;domain.com show_users.php &lt;/b&gt;page we need to set an header as below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;header(&#39;Access-Control-Allow-Origin: *&#39;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
We can set the &quot;&lt;b&gt;Access-Control-Allow-Origin&quot; &lt;/b&gt;with only one IP address or &#39;&lt;b&gt;*&lt;/b&gt;&#39; if it is not limited to single IP address&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/216803395555005461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/216803395555005461' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/216803395555005461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/216803395555005461'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/10/ajax-with-cross-domain.html' title='ajax with cross domain'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-5413269219720214453</id><published>2013-10-06T18:59:00.000-07:00</published><updated>2013-10-06T18:59:37.769-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript functions"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery validation"/><title type='text'>Verify whether HTML object has the event using javascript or jQuery</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;We would be using multiple events or plugins to get our requirement done using jQuery.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;While adding them we may not know whether the plugin is activated or not that gives error to the browser if it does not initiate and stops the next line of scripts in jQuery which we should not be doing.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;To get rid of this, we can use jQuery&amp;nbsp;&lt;b&gt;hasOwnProperty&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;which tells whether the HTML object has the event which we are checking for.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;Below is the sample code:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;Consider we have included the CKEDITOR in the script and it applies for the textareas.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;html&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;ckeditor.js&quot;&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;title&amp;gt;Test Object Event Existence&amp;lt;/title&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;/head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;ul&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;li&amp;gt;First name: &amp;lt;input type=&quot;text&quot; name=&quot;fname&quot; /&amp;gt; &amp;lt;/li&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;li&amp;gt;Last name: &amp;lt;input type=&quot;text&quot; name=&quot;lname&quot; /&amp;gt; &amp;lt;/li&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;li&amp;gt;Address: &amp;lt;textarea name=&quot;address&quot; id=&quot;address&quot; &amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;/li&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;/ul&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;/body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&amp;lt;/html&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;For the above script, to check whether the textareas has CKEDITOR or not we can check as below&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;$(&#39;#address&#39;)&lt;/b&gt;.&lt;/span&gt;&lt;b style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;hasOwnProperty(&#39;CKEDITOR&#39;)&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;If it exists it returns true else returns false.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/5413269219720214453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/5413269219720214453' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5413269219720214453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5413269219720214453'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/10/verify-whether-html-object-has-event.html' title='Verify whether HTML object has the event using javascript or jQuery'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-2372237708455389609</id><published>2013-07-29T10:08:00.000-07:00</published><updated>2013-07-29T10:08:29.206-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="client side scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript functions"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Decode html entities using javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below is the code to decode the html entities using javascript rather than the Server side scripting&lt;br /&gt;
&lt;br /&gt;
function decodeEntities(input) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; var y = document.createElement(&#39;textarea&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; y.innerHTML = input;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return y.value;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Above function just receives the html values like below&lt;br /&gt;
&lt;br /&gt;
var str = &quot;&amp;lt;p&amp;gt;Hello World&amp;lt;br /&amp;gt;This is the test message&quot;;&lt;br /&gt;
&lt;br /&gt;
When we pass the above HTML string to the function it returns as below,&lt;br /&gt;
&lt;br /&gt;
calling the &lt;b&gt;JAVASCRIPT function&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
decodeEntities(str)&lt;br /&gt;
&lt;br /&gt;
Output is: &lt;b&gt;&quot;&amp;amp;lt;p&amp;amp;gt;Hello World&amp;amp;lt;br/&amp;amp;gt;This is the test message&quot;&lt;/b&gt;;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/2372237708455389609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/2372237708455389609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2372237708455389609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2372237708455389609'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/07/decode-html-entities-using-javascript.html' title='Decode html entities using javascript'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-2341094135741579673</id><published>2013-07-18T10:51:00.000-07:00</published><updated>2013-07-18T10:51:29.600-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript functions"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><title type='text'>Disable right click in a page using javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
When we want to restrict the right click of the mouse in some of the pages, need to add the below code in the &lt;b&gt;&amp;lt;head&amp;gt; &amp;lt;/head&amp;gt;&lt;/b&gt;&amp;nbsp;tag within the &lt;b&gt;JAVASCRIPT&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
var message=&quot;Sorry, Right Click has been disabled&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function clickIE() {if (document.all) {window.console.log(message);return false;}}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;function clickNS(e) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if (document.layers||(document.getElementById&amp;amp;&amp;amp;!document.all)) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (e.which==2||e.which==3) {window.console.log(message);return false;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (document.layers)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; document.oncontextmenu=new Function(&quot;return false&quot;)&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/script&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/2341094135741579673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/2341094135741579673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2341094135741579673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2341094135741579673'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/07/disable-right-click-in-page-using.html' title='Disable right click in a page using javascript'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-7120116549971367341</id><published>2013-07-15T10:02:00.000-07:00</published><updated>2013-07-15T10:02:21.379-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery validation"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorials"/><title type='text'>how to select all options in multi select dropdown using jquery</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
When we use multi select drop down, we may consider the feature for selecting all and deselect all option for the respective Multi Select box.&lt;br /&gt;
&lt;br /&gt;
Using jQuery, we can easily do the &lt;b&gt;select all &lt;/b&gt;and &lt;b&gt;deselect all &lt;/b&gt;option for the dropdown.&lt;br /&gt;
&lt;br /&gt;
Below is the code to &lt;b&gt;select all &lt;/b&gt;using &lt;b&gt;jQuery&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;HTML&lt;/b&gt;&lt;br /&gt;
&amp;lt;select name=&quot;education&quot; id=&quot;education&quot; multiple=&quot;multiple&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;option value=&quot;1&quot;&amp;gt;Under Graduate&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;option value=&quot;2&quot;&amp;gt;Graduate&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;option value=&quot;3&quot;&amp;gt;Post Graduate&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;option value=&quot;4&quot;&amp;gt;Pursuing Graduation&amp;lt;/option&amp;gt; &amp;nbsp;&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;$(&#39;#education&#39;).find(&#39;option&#39;).attr(&#39;selected&#39;,&#39;selected&#39;);&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Where &#39;&lt;b&gt;education&lt;/b&gt;&#39; is the id for the multi select &amp;amp; we are adding the attribute selected to get selected.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;To deselect all &lt;/b&gt;using jQuery.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;$(&#39;#education&#39;).find(&#39;option&#39;).removeAttr(&#39;selected&#39;,&#39;selected&#39;);&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/7120116549971367341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/7120116549971367341' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7120116549971367341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7120116549971367341'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/07/how-to-select-all-options-in-multi.html' title='how to select all options in multi select dropdown using jquery'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-2745363447335009802</id><published>2013-01-30T10:48:00.001-08:00</published><updated>2013-01-30T10:49:25.346-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><category scheme="http://www.blogger.com/atom/ns#" term="php security"/><category scheme="http://www.blogger.com/atom/ns#" term="putty"/><category scheme="http://www.blogger.com/atom/ns#" term="server access"/><category scheme="http://www.blogger.com/atom/ns#" term="unix commands"/><title type='text'>Basic UNIX commands</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
Below are the basic unix commands which may help you while using PUTTY to access the server. Move, copy, view the pages from folder to other destination. All other basic stuff syntax are given below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there are images in this attachment, they will not be displayed. &amp;nbsp;Download the original attachment&lt;br /&gt;
Unix Basic Commands&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Copy:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;cp sorce_file target_file &amp;nbsp;:copies only if the files are in current direc&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;cp -r sor_DIR target_dir (to copy directories)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Move/Rename;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;mv file1 file2&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;mv -i f1 f2 (asks for permision to move or not)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Remove:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;rm filename&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;rm -r file (to remove directory structure)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;rm -i file ( asks for permision to move or not)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;view:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;cat filename ( to view the complete file content)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;To extract or unzip files:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;unzip file ( extracts file to current dir)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;To uncompress&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;uncompress filename&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;To compress&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;compress filename&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;To change directory&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;cd path&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;to list files in current dir&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;ls&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;ls -l (long list of files : gives acess permision,creation date..etc)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; -a(list all files satarting with a &quot; .&quot;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;to make a dir&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;mkdir name or md name&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;to remove&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;rmdir dir_name&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;to clear the screen&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;clear (clears the windoe or terminal)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;help commands&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;man &amp;lt;comd name&amp;gt; (displays the mannual page)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;whatis &amp;lt;cammnd&amp;gt; (gives description)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;date (to dispaly the date)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;to count the words&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;wc filename (gives lines,words,characters&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;wc -l file (only lines)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;wc -c file(only characters)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;wc -w file(onbly words)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;df ( displays the amount of free space)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;grep (search a file for matching pattern)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;grep [optioln]&amp;lt;regularExpression filename&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;eg: grep [a-z]*.c filename&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/2745363447335009802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/2745363447335009802' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2745363447335009802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/2745363447335009802'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/01/basic-unix-commands.html' title='Basic UNIX commands'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-4236939834339942979</id><published>2013-01-16T08:28:00.000-08:00</published><updated>2013-01-16T08:28:02.143-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="file operations"/><category scheme="http://www.blogger.com/atom/ns#" term="htaccess"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><category scheme="http://www.blogger.com/atom/ns#" term="php security"/><title type='text'>Upload huge files in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
When we try to upload huge files using PHP, we face many issues to upload. One of them might be the &lt;b&gt;php_value upload_max_filesize &lt;/b&gt;which is by default 2M in &lt;b&gt;php.ini&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Still we may have other issues which we need to do fix them. Below are the steps we need to add in &lt;b&gt;htaccess &lt;/b&gt;to fix the large file uploads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: x-small;&quot;&gt;&lt;b&gt;php_value upload_max_filesize 10M&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: x-small;&quot;&gt;&lt;b&gt;php_value post_max_size 64M&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: x-small;&quot;&gt;&lt;b&gt;php_value max_execution_time 300&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: x-small;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: x-small;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/4236939834339942979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/4236939834339942979' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/4236939834339942979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/4236939834339942979'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/01/upload-huge-files-in-php.html' title='Upload huge files in PHP'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-4349311233485467628</id><published>2013-01-03T09:17:00.000-08:00</published><updated>2013-01-03T09:17:49.886-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="file operations"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript validation"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery validation"/><category scheme="http://www.blogger.com/atom/ns#" term="validation tips"/><title type='text'>javascript validation for file upload</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below is the article for adding javascript validation (or) jquery validation for a file upload that makes our life easier whether the file upload is a valid type or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if(&lt;b&gt;$(&#39;#upload_file&#39;).val()&lt;/b&gt; != &#39;&#39;)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var _validFileExtensions =&lt;b&gt; [&quot;.jpg&quot;, &quot;.jpeg&quot;, &quot;.bmp&quot;, &quot;.gif&quot;, &quot;.png&quot;]&lt;/b&gt;; &lt;span style=&quot;color: #444444;&quot;&gt;// Can change the extensions if we need for doc type or something else&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(&lt;b&gt;$(&#39;#upload_file&#39;).val()&lt;/b&gt; != &#39;&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var sFileName =&lt;b&gt; $(&#39;#upload_file&#39;).val()&lt;/b&gt;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var blnValid = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (var j = 0; j &amp;lt; _validFileExtensions.length; j++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var sCurExtension = _validFileExtensions[j];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (sFileName.substr(sFileName.length - sCurExtension.length, sCurExtension.length).toLowerCase() == sCurExtension.toLowerCase()) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; blnValid = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(!blnValid)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;alert(&quot;Sorry, &quot; + sFileName + &quot; is invalid, allowed extensions are: &quot; + _validFileExtensions.join(&quot;, &quot;));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(&#39;#upload_file&#39;).focus();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/4349311233485467628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/4349311233485467628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/4349311233485467628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/4349311233485467628'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2013/01/javascript-validation-for-file-upload.html' title='javascript validation for file upload'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-4797348973516507912</id><published>2012-09-01T05:16:00.001-07:00</published><updated>2012-09-01T05:19:50.512-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Generate random code using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Below is the function to generate a random code(alpha-numeric) using PHP. We can use the below function for generating a coupon code (or) verification code (or) affiliate code for the people.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div bgcolor=&quot;#ffffff&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;span style=&quot;font-family: Arial; font-size: x-small;&quot;&gt;function &lt;b&gt;generate_random_code&lt;/b&gt;( &lt;b&gt;$size&lt;/b&gt; )&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $list_chars = array_merge(range(&#39;A&#39;,&#39;Z&#39;), range(0,9));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $referal_code = &#39;&#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for($i=0;$i&amp;lt;=&lt;b&gt;$size&lt;/b&gt;;$i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $referal_code .= $list_chars[mt_rand(0, count($list_chars)-1)];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $referal_code;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;
&lt;br /&gt;
&lt;b&gt;$size &amp;nbsp;&lt;/b&gt;=&amp;gt; Length of the random code to be generated.&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/4797348973516507912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/4797348973516507912' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/4797348973516507912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/4797348973516507912'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/09/generate-random-code-using-php.html' title='Generate random code using PHP'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-6873269390323872384</id><published>2012-06-13T10:59:00.006-07:00</published><updated>2012-06-13T10:59:57.676-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Calculate time difference using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp;function get_time_difference_php($&lt;wbr&gt;&lt;/wbr&gt;created_time)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp;{&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; date_default_timezone_set(&#39;&lt;wbr&gt;&lt;/wbr&gt;Asia/Calcutta&#39;); //Change as per your default time&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $str = strtotime($created_time);&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $today = strtotime(date(&#39;Y-m-d H:i:s&#39;));&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // It returns the time difference in Seconds...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $time_differnce = $today-$str;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Years...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $years = 60*60*24*365;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Months...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $months = 60*60*24*30;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Days...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $days = 60*60*24;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Hours...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $hours = 60*60;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Minutes...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $minutes = 60;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;years) &amp;gt; 1)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval($time_differnce/$years)&lt;wbr&gt;&lt;/wbr&gt;.&quot; years ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;years) &amp;gt; 0)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval($time_differnce/$years)&lt;wbr&gt;&lt;/wbr&gt;.&quot; year ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months) &amp;gt; 1)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months).&quot; months ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months)) &amp;gt; 0)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months)).&quot; month ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;days)) &amp;gt; 1)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce/$days)&lt;wbr&gt;&lt;/wbr&gt;).&quot; days ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;days)) &amp;gt; 0)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce/$days)&lt;wbr&gt;&lt;/wbr&gt;).&quot; day ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)) &amp;gt; 1)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)).&quot; hours ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)) &amp;gt; 0)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)).&quot; hour ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)) &amp;gt; 1)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)).&quot; minutes ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)) &amp;gt; 0)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)).&quot; minute ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce)) &amp;gt; 1)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return intval(($time_differnce)).&quot; seconds ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &quot;few seconds ago&quot;;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/6873269390323872384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/6873269390323872384' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6873269390323872384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6873269390323872384'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/06/calculate-time-difference-using-php.html' title='Calculate time difference using PHP'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-7227482576437179829</id><published>2012-06-05T11:22:00.000-07:00</published><updated>2012-06-05T11:22:25.402-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql help"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Difference between current date and past date using MySQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
Below is the function to get the time difference between Current date and the past date using MySQL. Mainly it can be used where we want to display the time gap between the registration of the user.&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;function&lt;/b&gt; getTimeDifference(&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;$created_&lt;wbr&gt;&lt;/wbr&gt;since&lt;/span&gt;&lt;/b&gt;)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
{&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $datediffquery = mysql_query &amp;nbsp;(&quot;&lt;b&gt;SELECT CASE WHEN TIMESTAMPDIFF(YEAR ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 1 THEN CONCAT(TIMESTAMPDIFF(YEAR ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; years ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(YEAR ,&#39;&quot;.&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;$created_&lt;wbr&gt;&lt;/wbr&gt;since&lt;/span&gt;&lt;/b&gt;&lt;b&gt;.&quot;&#39;, NOW()) &amp;gt; 0 THEN CONCAT(TIMESTAMPDIFF(YEAR ,&#39;&quot;.&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;$created_&lt;wbr&gt;&lt;/wbr&gt;since&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;b&gt;.&quot;&#39;, NOW()), &#39; year ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(MONTH ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 1 THEN CONCAT(TIMESTAMPDIFF(MONTH ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; months ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(MONTH ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 0 THEN CONCAT(TIMESTAMPDIFF(MONTH ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; month ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(DAY ,&#39;&quot;&lt;span style=&quot;color: red;&quot;&gt;.$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 1 THEN CONCAT(TIMESTAMPDIFF(DAY ,&#39;&quot;&lt;span style=&quot;color: red;&quot;&gt;.$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; days ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(DAY ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 0 THEN CONCAT(TIMESTAMPDIFF(DAY ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; day ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(HOUR ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 1 THEN CONCAT(TIMESTAMPDIFF(HOUR ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; hours ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(HOUR ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 0 THEN CONCAT(TIMESTAMPDIFF(HOUR ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; hour ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(MINUTE ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 1 THEN CONCAT(TIMESTAMPDIFF(MINUTE ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; minutes ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(MINUTE ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 0 THEN CONCAT(TIMESTAMPDIFF(MINUTE ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; minute ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN TIMESTAMPDIFF(SECOND ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()) &amp;gt; 1 THEN CONCAT(TIMESTAMPDIFF(SECOND ,&#39;&quot;.&lt;span style=&quot;color: red;&quot;&gt;$created_since&lt;/span&gt;.&quot;&#39;, NOW()), &#39; seconds ago&#39;)&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; END&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AS total_days&lt;/b&gt;&quot;);&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $row = mysql_fetch_assoc($&lt;wbr&gt;&lt;/wbr&gt;datediffquery);&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return $row[&#39;total_days&#39;];&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/7227482576437179829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/7227482576437179829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7227482576437179829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7227482576437179829'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/06/difference-between-current-date-and.html' title='Difference between current date and past date using MySQL'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-6858483909204127638</id><published>2012-05-25T11:19:00.000-07:00</published><updated>2012-05-25T11:19:05.460-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Calculate time difference between two dates using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below is the PHP function to calculate the time difference between current date and the given date.&lt;br /&gt;
&lt;br /&gt;
It will returns in Seconds, minutes, months (or) years based on the time difference.&lt;br /&gt;
&lt;br /&gt;
And it can be used to calculate the time difference between two dates by changing the&lt;b&gt;&amp;nbsp;$today&lt;/b&gt;&amp;nbsp;with the date which you want to pass.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
function &lt;b&gt;get_time_difference_php&lt;/b&gt;($&lt;wbr&gt;&lt;/wbr&gt;created_time)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; date_default_timezone_set(&#39;&lt;wbr&gt;&lt;/wbr&gt;Asia/Calcutta&#39;);&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $str = strtotime($created_time);&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $today = strtotime(date(&#39;Y-m-d H:i:s&#39;));&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // It returns the time difference in Seconds...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $time_differnce = $today-$str;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Years...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $years = 60*60*24*365;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Months...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $months = 60*60*24*30;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Days...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $days = 60*60*24;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Hours...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $hours = 60*60;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // To Calculate the time difference in Minutes...&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $minutes = 60;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;years) &amp;gt; 1)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return intval($time_differnce/$years)&lt;wbr&gt;&lt;/wbr&gt;.&quot; years ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;years) &amp;gt; 0)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt; return intval($time_differnce/$years)&lt;wbr&gt;&lt;/wbr&gt;.&quot; year ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months) &amp;gt; 1)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt; return intval($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months).&quot; months ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months)) &amp;gt; 0)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;months)).&quot; month ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if(intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;days)) &amp;gt; 1)&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return intval(($time_differnce/$days)&lt;wbr&gt;&lt;/wbr&gt;).&quot; days ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;days)) &amp;gt; 0)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return intval(($time_differnce/$days)&lt;wbr&gt;&lt;/wbr&gt;).&quot; day ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)) &amp;gt; 1)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt; return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)).&quot; hours ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)) &amp;gt; 0)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;hours)).&quot; hour ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)) &amp;gt; 1)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)).&quot; minutes ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)) &amp;gt; 0)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return intval(($time_differnce/$&lt;wbr&gt;&lt;/wbr&gt;minutes)).&quot; minute ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else if (intval(($time_differnce)) &amp;gt; 1)&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: red;&quot;&gt; return intval(($time_differnce)).&quot; seconds ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;return &quot;few seconds ago&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div style=&quot;font-family: arial; font-size: small; text-align: -webkit-auto;&quot;&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/6858483909204127638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/6858483909204127638' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6858483909204127638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6858483909204127638'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/05/calculate-time-difference-between-two.html' title='Calculate time difference between two dates using PHP'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-5123877652348530788</id><published>2012-04-21T06:44:00.000-07:00</published><updated>2012-04-21T06:44:10.190-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql help"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Load file using MySQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Most of the Programmers will be using the normal file operations to import a CSV file, we can use MySQL Load file too import a CSV to database table.&lt;br /&gt;
&lt;br /&gt;
Below is the syntax to import the file to DB&lt;br /&gt;
&lt;br /&gt;
LOAD DATA INFILE &quot;/home/mysql/data/my_table_data.csv&quot; INTO TABLE dummy_table FIELDS TERMINATED BY &#39;,&#39; LINES TERMINATED BY &#39;\n&#39;;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/5123877652348530788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/5123877652348530788' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5123877652348530788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5123877652348530788'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/04/load-file-using-mysql.html' title='Load file using MySQL'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-7077247786029992500</id><published>2012-03-07T10:44:00.000-08:00</published><updated>2012-03-07T10:44:36.021-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="php help"/><title type='text'>Retrieve the XML node value using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;When we want to read the XML tag value, we may use simple_xml_load or DOMdocument to read it and will get the particular node value. Below is the simple PHP function to retrieve the XML node value by passing the XML as string and passing the starting XML tag and ending XML tag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function &lt;b&gt;get_value_by_tag_Name&lt;/b&gt;( $str, $s_tag, $e_tag)&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$s = strpos( $str,$s_tag) + strlen( $s_tag);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$e = strlen( $str);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$str= substr($str, $s, $e);&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$e = strpos( $str,$e_tag);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$str= substr($str,0, $e);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$str= substr($str,0, $e);&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return &amp;nbsp;$str;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Here $str is the XML which we are passing as a string, $s_tag is the Starting tag(Ex: &#39;&amp;lt;EmployeeDetails&#39;&amp;gt;) and $e_tag is the ending tag (Ex: &#39;&amp;lt;/EmployeeDetails&amp;gt;&#39;). By passing the values it returns the node value.&lt;br /&gt;
&lt;br /&gt;
So, it reduces the parsing XML and DOM Document steps.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/7077247786029992500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/7077247786029992500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7077247786029992500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/7077247786029992500'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/03/retrieve-xml-node-value-using-php.html' title='Retrieve the XML node value using PHP'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-6085871200542293244</id><published>2012-01-26T02:47:00.001-08:00</published><updated>2012-03-07T10:45:50.799-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql help"/><title type='text'>Difference between MyISAM and InnoDB MySQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;InnoDB and MyISAM most popular storage engines in MySQL &amp;amp; also mostly used storage engine is the MyISAM. But most of them don&#39;t know the importance of InnoDB.&lt;br /&gt;
&lt;br /&gt;
Below are the basic differences of MyISAM and InnoDB.&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;InnoDB supports transactions which is not supported by tables which use MyISAM storage engine. Transaction is nothing but a set of MySQL queries run in an Stored Procedure as shown (BEGIN TRANSACTION ......SET of QUERIES ......END).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;InnoDB has row-level locking, relational integrity i.e. supports foreign key relationship between tables, which is not possible in MyISAM.&lt;/li&gt;
&lt;li&gt;InnoDB ‘s performance for higher volume data which cannot be beaten by any other storage engines available.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;Tables created in MyISAM are known to be much faster compared to tables in InnoDB. But since InnoDB supports volume, transactions, integrity it’s always a better option when we are dealing with a larger database.&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/6085871200542293244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/6085871200542293244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6085871200542293244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/6085871200542293244'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/01/difference-between-myisam-and-innodb.html' title='Difference between MyISAM and InnoDB MySQL'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-5774354045728032702</id><published>2012-01-26T02:13:00.000-08:00</published><updated>2012-01-26T02:13:23.632-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql help"/><title type='text'>Find the nth highest Salary in a table using MySQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;To find the nth highest salary or highest score in a table, below is the query to find out.&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM employee a WHERE &lt;b&gt;n&lt;/b&gt; = (SELECT COUNT(*) FROM employee b WHERE a.salary &amp;lt;= b.salary) ;&lt;br /&gt;
&lt;br /&gt;
&#39;&lt;b&gt;n&lt;/b&gt;&#39; &amp;nbsp;--&amp;gt; By replacing n with the required value we can get the second, third, fourth highest and so on..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/5774354045728032702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/5774354045728032702' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5774354045728032702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/5774354045728032702'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/01/find-nth-highest-salary-in-table-using.html' title='Find the nth highest Salary in a table using MySQL'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2336789181658789034.post-3293140476117948899</id><published>2012-01-24T02:46:00.000-08:00</published><updated>2012-01-24T02:46:30.270-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript help"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery"/><title type='text'>jQuery Form Validation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Tired of validating the form using javascript. Here is the code to validate the form using jQuery.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;b&gt;function &lt;/b&gt;submit_form()&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;var formElements = $(&#39;#form_name .required&#39;); // Reading all elements in the form which are having class as required&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;var error = 0;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;formElements.each(function() { // Looping all the elements which are having the class name as required...&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;if($(this).val() == &quot;&quot;) { &amp;nbsp;// Checking the value of the field&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Showing the border color as red if the field is empty&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$(this).css(&#39;border&#39;,&#39;1px solid red&#39;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;error++;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;} else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // removing the border if the field has the value....&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;      &lt;/span&gt;$(this).css(&#39;border&#39;,&#39;none&#39;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;});&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
&lt;br /&gt;
Use the submit_form function in onsubmit of the form.&lt;br /&gt;
&lt;br /&gt;
The fields in the form which need to be validated should be given as below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;input type=&quot;text&quot; name=&quot;field_name&quot;&lt;b&gt; class=&quot;required&quot;&lt;/b&gt; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we add the class required for the textbox, it validates otherwise it doesnot validate the textbox.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://anilkajadoo.blogspot.com/feeds/3293140476117948899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2336789181658789034/3293140476117948899' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/3293140476117948899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2336789181658789034/posts/default/3293140476117948899'/><link rel='alternate' type='text/html' href='http://anilkajadoo.blogspot.com/2012/01/jquery-form-validation.html' title='jQuery Form Validation'/><author><name>Anil Kumar</name><uri>http://www.blogger.com/profile/10833775161659162775</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWMhUhf99gHfOD4dLY3p8DpBFxjLzwExyCDz6i1jkTx3GLKJW_a_fazh3TW_O4mzm6PAYHHb2IsZ4brBpgnyERndrvAoh0pgHc7JbnaNRBeMX5UI-2LcDeRc9DDlq9GE/s1600/17aedb5.jpg'/></author><thr:total>0</thr:total></entry></feed>