This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AND (SUBSTRING_INDEX(SUBSTR(email, INSTR(email, '@') + 1),'.',1)) IN('yahoo', 'ymail', 'bt', 'rocketmail', 'msn', 'live', 'hotmail') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
(CASE | |
WHEN u.dob BETWEEN DATE_SUB(CURDATE(),INTERVAL 80 YEAR) AND DATE_SUB(CURDATE(),INTERVAL 75 YEAR) THEN '80-75' | |
WHEN u.dob BETWEEN DATE_SUB(CURDATE(),INTERVAL 75 YEAR) AND DATE_SUB(CURDATE(),INTERVAL 70 YEAR) THEN '75-70' | |
WHEN u.dob BETWEEN DATE_SUB(CURDATE(),INTERVAL 70 YEAR) AND DATE_SUB(CURDATE(),INTERVAL 65 YEAR) THEN '70-65' | |
WHEN u.dob BETWEEN DATE_SUB(CURDATE(),INTERVAL 65 YEAR) AND DATE_SUB(CURDATE(),INTERVAL 60 YEAR) THEN '65-60' | |
WHEN u.dob BETWEEN DATE_SUB(CURDATE(),INTERVAL 60 YEAR) AND DATE_SUB(CURDATE(),INTERVAL 55 YEAR) THEN '60-55' | |
WHEN u.dob BETWEEN DATE_SUB(CURDATE(),INTERVAL 55 YEAR) AND DATE_SUB(CURDATE(),INTERVAL 50 YEAR) THEN '55-50' | |
WHEN u.dob < DATE_SUB(CURDATE(),INTERVAL 80 YEAR) THEN '80+' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CASE | |
-- -- Child turning 2 within 2 month periods | |
WHEN ue.baby_due_date BETWEEN DATE_SUB(NOW(), INTERVAL 16 MONTH) AND DATE_SUB(NOW(), INTERVAL 14 MONTH) THEN CONCAT(DATE_ADD(CURDATE(), INTERVAL 8 MONTH ), ' to ', DATE_ADD(CURDATE(), INTERVAL 10 MONTH )) | |
WHEN ue.baby_due_date BETWEEN DATE_SUB(NOW(), INTERVAL 18 MONTH) AND DATE_SUB(NOW(), INTERVAL 16 MONTH) THEN CONCAT(DATE_ADD(CURDATE(), INTERVAL 6 MONTH ), ' to ', DATE_ADD(CURDATE(), INTERVAL 8 MONTH )) | |
WHEN ue.baby_due_date BETWEEN DATE_SUB(NOW(), INTERVAL 20 MONTH) AND DATE_SUB(NOW(), INTERVAL 18 MONTH) THEN CONCAT(DATE_ADD(CURDATE(), INTERVAL 4 MONTH ), ' to ', DATE_ADD(CURDATE(), INTERVAL 6 MONTH )) | |
WHEN ue.baby_due_date BETWEEN DATE_SUB(NOW(), INTERVAL 22 MONTH) AND DATE_SUB(NOW(), INTERVAL 20 MONTH) THEN CONCAT(DATE_ADD(CURDATE(), INTERVAL 2 MONTH ), ' to ', DATE_ADD(CURDATE(), INTERVAL 4 MONTH )) | |
WHEN ue.baby_due_date BETWEEN DATE_SUB(NOW(), INTERVAL 24 MONTH) AND DATE_SUB(NOW(), INTERVAL 22 MONTH) THEN CONCAT(CURDATE(), ' to ', DATE_ADD(CURDAT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Accessing array elements with square bracket syntax ¶ | |
Array elements can be accessed using the array[key] syntax. | |
*/ | |
$array = array( | |
"foo" => "bar", | |
42 => 24, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$searchstring = "Alan Coleman is Grrrrate!"; | |
$arraycheck = array("\*", "!", "@", ",", "%"); | |
if (preg_match('/'.implode('|', $arraycheck).'/', $searchstring, $matches)) { | |
echo("Fail, the string '{$matches[0]}' was found in the search string."); | |
} else { | |
echo("Pass, None of the strings in the array were found in the search string."); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Use rsync to move files from old server to local, run from local machine | |
rsync -chavzP --stats [email protected]:/home/alancoleman/domains /home/alan/Documents/domain_files | |
* Use wget to download the latest copy of WordPress | |
wget http://wordpress.org/latest.tar.gz | |
* Unpack WordPress download |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Declare new array | |
$fieldsarrsql = array(); | |
// Loop through origional array | |
foreach ($origarray as $fieldsarr) { | |
// Populate new array with associated data | |
$fieldsarrsql[] = array( | |
'tablealias'=>$fieldsarr['tablealias'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WHERE date >= DATE_SUB(NOW(), INTERVAL 8 MONTH) | |
-- Returns everything within the last 8 months |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATE_FORMAT(date,'%Y-%m-%d') AS 'date_new_format' | |
-- Returns 2013-12-08 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CASE | |
WHEN email REGEXP '@msn|@live|@hotmail' THEN 0 | |
ELSE | |
1 | |
END | |
AS 'Mailer' |