How to Fix a Hacked WordPress Site
Category: Others
How to Access Linux SSH Command prompt from windows 10
Mysql query to fetch current month data
Sometimes we need to show only current month data in the application ,so for easy handling the data we should use a Mysql query to fetch current month data.Let we check out how to do that using one MySQL query
See below the Mysql query to fetch current month data
SELECT * FROM leads WHERE MONTH(date) = MONTH(CURRENT_DATE()) AND YEAR(date) = YEAR(CURRENT_DATE()) // leads= Table Name // date = date field name
Here we are fetching current month data using the feature MONTH(CURRENT_DATE()) and MONTH(date)
MONTH(CURRENT_DATE()) will result 8 (since current month is Aug)
Next feature we are using in Mysql query to fetch current month data is YEAR(date) and YEAR(CURRENT_DATE())
YEAR(CURRENT_DATE()) will result 2019 (since today is Aug 24 2019)
so actual Mysql query to fetch current month data will work like this
SELECT *
FROM leads
WHERE MONTH(date) = 9
AND YEAR(date) = 2019
so it will fetch all result form database table leads that having date field value is in august month
jQuery code to copy input value to clipboard
Here we are going to explore jQuery code to copy input value to clipboard,Fortunately we have jQuery library function to copy value to clipboard see the code in details to copy input value to clipboard
document.execCommand("copy");
Now see in details jQuery code to copy input value to clipboard
Suppose i have an input field with id result_value
<input type="text" size="12" class="result_input" id="result_value" value="jQuery code to copy input value to clipboard">
I have to copy the the value to clipborad
<script> (function ( $ ) { $.fn.copy_text = function() { $( ".result_value" ).blur(function() { $("#result_value").select(); document.execCommand("copy"); }); }; }( jQuery )); $('input').copy_text(); </script>
In simple jQuery code to copy input value to clipboard
$( ".result_value" ).blur(function() { $("#result_value").select(); document.execCommand("copy"); });
See Demo
copy input value to clipboard