MySQL Upcoming Birthdays Query

When I try to write a query for upcoming birthdays using MYSql, I get the below query to fetch the upcoming birthdays from the employee list. It may be useful to you. select * from ( select id, datediff(DATE_FORMAT(date_of_birth,concat(‘%’,YEAR(CURDATE()),’-%m-%d’)),NOW()) as no_of_days from employee union select id, datediff(DATE_FORMAT(date_of_birth,concat(‘%’,(YEAR(CURDATE())+1),’-%m-%d’)),NOW()) as no_of_days from employee ) AS upcomingbirthday WHERE […]

addcslashes

Syntax: string addcslashes ( string $str , string $charlist ) Description: Returns a string with backslashes before characters that are listed in charlist parameter.A list of characters to be escaped. Example 1 <?php $str=”hai…i like india”; echo ‘Input String :’.$str; echo ‘<br/>’; echo ‘Output String (addcslashes($str,”i”)) : ‘.addcslashes($str,’i’); echo ‘<br/>’; ?> OUTPUT Input String :hai…i like india Output […]

addslashes

Syntax: string addslashes ( string $str ) Description: Returns a string with backslashes before characters that need to be escaped. These characters are single quote (‘), double quote (“), backslash (\) and NUL Note: Using addcslashes() function we will configure the escaped string. Example 1 <?php $str=”How’re you”; echo ‘Input String :’.$str; echo ‘<br/>’; echo ‘Output String (addslashes($str)) […]

array_splice

Syntax:array array_splice ( array &$input , int $offset [, int $length = 0 [, mixed $replacement ]] ) Description:Remove a portion of the array and replace it with something else <?php $input = array(“red”, “green”, “blue”, “yellow”); array_splice($input, 2); print_r($input); echo “<br/>”; $input = array(“red”, “green”, “blue”, “yellow”); array_splice($input, 1, -1); print_r($input); ?> OUTPUT Array […]

bin2hex

Syntax: string bin2hex ( string $str ) Description: Returns an ASCII string containing the hexadecimal representation of str. Note: Using addcslashes() function we can configure the escaped string. Example <?php $str=”good morning”; echo bin2hex($str); ?> OUTPUT 676f6f64206d6f726e696e67