How to find BIRTHDAY FRIENDS Who is celebrating today using PHP and MYSQL
4 answers
This person is processing February 29 - March 1 treatment as a holiday during off-peak years.
SELECT u.name
FROM users u INNER JOIN friendships f ON (f.user_id = u.id)
WHERE f.friend_id = 6 -- whatever your id is
AND (
MONTH(u.birthdate) = MONTH(NOW())
AND DAY(u.birthdate) = DAY(NOW())
) OR (
MONTH(c.birthdate) = 2 AND DAY(c.birthdate) = 29
AND MONTH(NOW()) = 3 AND DAY(NOW()) = 1
AND (YEAR(NOW()) % 4 = 0)
AND ((YEAR(NOW()) % 100 != 0) OR (YEAR(NOW()) % 400 = 0))
)
Without seeing your table structure, I was just guessing how you handle friendship links
+8
source to share
You can combine the cURL calls to http://www.birthdatabase.com in your application and read the HTML in the results.
Edit . I may have misunderstood your question. If you are trying to pull birthdays from a different database (not yours) this might be your solution.
0
source to share