Select all data from MySQL where varchar date greater than today ?

To select all event from MySQL varchar date, that start from tomorrow onwards, for that we have a easy method via using  STR_TO_DATE function.It convert stored date and compare with CURDATE() function

Here in this example I have an even table, in that table event start date is stored in the filed named event_start_time, my requirement is to fetch all event that is greater than today date and ineed in the event date ascending order.

See MySQL query

SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') > CURDATE() ORDER BY STR_TO_DATE(event_start_time,'%d-%m-%Y') Asc

To Fetch coming 7 days data event

SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') > CURDATE() AND STR_TO_DATE(event_start_time, '%d-%m-%Y') <= CURDATE() + INTERVAL 7 DAY 

To Fetch coming one month data event

SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') > CURDATE() AND STR_TO_DATE(event_start_time, '%d-%m-%Y') <= CURDATE() + INTERVAL 30 DAY 

To fetch Today’s Event

SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') = CURDATE()

How To Install Free cPanel in Linux Centos ?

Unfortunately cpanel is not a free software it is asking around Cost of 15 USD per month.But we have lot of similar software doing exactly the same functionality,out of that Zpanel is free and most popular.In this article am elaborate how to intall Zpanel in your system

1)  Clean OS (This installer is designed to install and configure ZPanel on a clean OS installation only!) 

#rm -rf *

2) Reboot your OS
#reboot

3 ) Download the install files from Github

# wget https://raw.github.com/zpanel/installers/master/install/CentOS-6_4/10_1_1.sh

4)  Change the permissions

#chmod +x 10_1_1.sh
5)  Run the installer

#./10_1_1.sh

how to add facebook live chat in a website

One of the main difficulty most of the developers faced is to add live chat in a website. Nowadays thousand of online chat are available most of them have their on draw backs.But Facebook come up with new chat frame , it is one of the easiest and  light weight live chat .here we are discuss how we can add fb chat in a website

 

1) After <body> tag add this code

 <!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
 var js, fjs = d.getElementsByTagName(s)[0];
 if (d.getElementById(id)) return;
 js = d.createElement(s); js.id = id;
 js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js#xfbml=1&version=v2.12&autoLogAppEvents=1';
 fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<!-- Your customer chat code -->
<div class="fb-customerchat"
 attribution="setup_tool"
 page_id="281874699030661">
</div>

2) Replace page id ( now:281874699030661)

3) In FB page setting > Messenger platform add White-listed domains

facebook-live-chat-into-websites

PHP code to Send HTML Mail templates

PHP provide easy method to send HTML template inside mail function.Here am going to elaborate that with you

Here is the code

First you have to specify Content-type:text/html;charset=UTF-8 in header

see

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

Subject specify mail subject

see

$subject="Tutorialshore: HAPPY TO SHARE OUR NEW LOCATION WITH YOU";

Message specify HTML mail messgae

see

$message = "<html><body><h1>OUR NEW LOCATION</h1><p>Welcome you</p><p><img alt="Happy New Year 2018 Wishes" src="https://www.tutorialshore.com/wp-content/uploads/2018/08/google-map-1-1024x576.png" /></p></body></html>";

Here is the full code

 $subject="Tutorialshore: HAPPY TO SHARE OUR NEW LOCATION WITH YOU";
$message = "<html><body><h1>OUR NEW LOCATION</h1><p>Welcome you</p><p><img alt="Happy New Year 2018 Wishes" src="https://www.tutorialshore.com/wp-content/uploads/2018/08/google-map-1-1024x576.png" /></p></body></html>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= $this->from_mail. "\r\n";
 
mail("[email protected]",$subject,$message,$headers);

Output Mail templates

OUR NEW LOCATION

Welcome you

Happy New Year 2018 Wishes