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

Show a div in every 10 Seconds if it is hidden using JQuery

Here am going to show you how to Show a div in every 10 Seconds if it is hidden using JQuery

<script type="text/javascript">
 $(document).ready(function() {
 setInterval(function() {
 if ($('#make_container').is(':hidden')) {
 $("#make_container").slideToggle();
 }
 }, 12000); 
 });</strong>
</script>

Suppose I have a html form

<div class="enquire-btn"><span id="enquire_click"> Enquire Now </span>
<div id="make_container" style="display:none";>
<div id="form_container">
<div id="form_fields" class="black">
<form accept-charset="UTF-8" action="send-enquiry.php" id="contact_us" method="post" novalidate>
<label>Name *</label>
<div class="f_rel">
<input class="required letterswithbasicpunc" id="contact_first_name" name="nam" size="30" style="width:100%" type="text">
</div>
<label>Email *</label>
<div class="f_rel">
<input class="required email" id="contact_email" name="ema" size="30" style="width:100%" type="text">
</div>
<label>Phone *</label>
<div class="f_rel">
<input class="required" id="contact_phone" minlength="10" name="mob" size="30" style="width:100%" type="text">
<input type="hidden" name="utmterm" value="<?php echo $utm_term; ?>">
<input type="hidden" name="pageUrl" value='<?php echo $pageUrl; ?>'>
<input class="project" name="project" value="Opus" type="hidden">
</div>
<label>Comments</label>
<div class="f_rel">
<textarea class="letterswithbasicpunc" id="contact_comments" name="msg" size="30" style="width:100%" type="text"></textarea>
</div>
<br>
<br>
 <input type="submit" class="btn contactSubmitBtn" value="Submit" id=</form>
</div>
</div>
</div>
</div>

It will show the form every 10 Seconds if it is hidden using JQuery