birthday script

Thread Solved

Join Date: Sep 2009
Posts: 201
Reputation: muralikalpana is an unknown quantity at this point 
Solved Threads: 11
muralikalpana's Avatar
muralikalpana muralikalpana is offline Offline
Posting Whiz in Training

birthday script

 
-1
  #1
Nov 23rd, 2009
hello,
i want to display names of upcoming birthdays whose between "today" to "end of every month". how to do this
Last edited by muralikalpana; Nov 23rd, 2009 at 3:51 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 201
Reputation: muralikalpana is an unknown quantity at this point 
Solved Threads: 11
muralikalpana's Avatar
muralikalpana muralikalpana is offline Offline
Posting Whiz in Training
 
0
  #2
Nov 23rd, 2009
Originally Posted by muralikalpana View Post
hello,
i want to display names of upcoming birthdays whose between "today" to "end of every month". how to do this
how to retrive values from database
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 185
Reputation: venkat0904 is an unknown quantity at this point 
Solved Threads: 20
venkat0904's Avatar
venkat0904 venkat0904 is offline Offline
Junior Poster
 
-1
  #3
Nov 23rd, 2009
Originally Posted by muralikalpana View Post
how to retrive values from database
assuming u have a field dob (with datatype as date) in user table this query can help u...
  1. $current_month = date(m);
  2. $current_day = date(d);
  3. $result = mysql_query("SELECT name FROM user WHERE month(dob) = $current_month AND day(dob) >= $current_day ")

Hope its clear..
cheers!!
Last edited by venkat0904; Nov 23rd, 2009 at 5:34 am.
Gimme reputation points if u find my post helpful.
use [code] tags wherever applicable
dont start a new thread unless u cant find the topic already on forum.
mark a thread "solved" as soon as u get a solution
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 201
Reputation: muralikalpana is an unknown quantity at this point 
Solved Threads: 11
muralikalpana's Avatar
muralikalpana muralikalpana is offline Offline
Posting Whiz in Training
 
0
  #4
Nov 23rd, 2009
  1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND day(dateofbirth) >=' at line 1
getting this error
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 115
Reputation: urtrivedi is an unknown quantity at this point 
Solved Threads: 16
urtrivedi urtrivedi is offline Offline
Junior Poster
 
0
  #5
Nov 23rd, 2009
  1. $result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ")
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 185
Reputation: venkat0904 is an unknown quantity at this point 
Solved Threads: 20
venkat0904's Avatar
venkat0904 venkat0904 is offline Offline
Junior Poster
 
1
  #6
Nov 23rd, 2009
Originally Posted by urtrivedi View Post
  1. $result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ")
yeah try that out... my bad... rightly deserve a negative point for that post
Actually u should alwayz save ur query in a variable and then execute it..
this way when u encounter an error , u can echo ur query statement and find out the source of error easily...
something like this..
  1. $query = "SELECT name FROM user WHERE month(dob) = ".$current_month." AND day(dob) >= ".$current_day;
  2. $result = mysql_query($query);
Last edited by venkat0904; Nov 23rd, 2009 at 7:52 am. Reason: improvising
Gimme reputation points if u find my post helpful.
use [code] tags wherever applicable
dont start a new thread unless u cant find the topic already on forum.
mark a thread "solved" as soon as u get a solution
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 201
Reputation: muralikalpana is an unknown quantity at this point 
Solved Threads: 11
muralikalpana's Avatar
muralikalpana muralikalpana is offline Offline
Posting Whiz in Training
 
-1
  #7
Nov 23rd, 2009
Originally Posted by venkat0904 View Post
yeah try that out... my bad... rightly deserve a negative point for that post
Actually u should alwayz save ur query in a variable and then execute it..
this way when u encounter an error , u can echo ur query statement and find out the source of error easily...
something like this..
  1. $query = "SELECT name FROM user WHERE month(dob) = ".$current_month." AND day(dob) >= ".$current_day;
  2. $result = mysql_query($query);
how to fetch date as this format: (example: 2nd aug 1986) like this
how to format?
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 201
Reputation: muralikalpana is an unknown quantity at this point 
Solved Threads: 11
muralikalpana's Avatar
muralikalpana muralikalpana is offline Offline
Posting Whiz in Training
 
-1
  #8
Nov 23rd, 2009
i want to display date format this (1989-03-09) as 9th mar 1989.
give an idea......how to format like this
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 185
Reputation: venkat0904 is an unknown quantity at this point 
Solved Threads: 20
venkat0904's Avatar
venkat0904 venkat0904 is offline Offline
Junior Poster
 
0
  #9
Nov 24th, 2009
Originally Posted by muralikalpana View Post
i want to display date format this (1989-03-09) as 9th mar 1989.
give an idea......how to format like this
use this query..
  1. $query = "SELECT name, DATE_FORMAT(dob, '%D %b %Y') FROM user WHERE month(dob) = ".$current_month." AND day(dob) >= ".$current_day;

I guess this is what u r lookin for...
Cheers!!
Last edited by venkat0904; Nov 24th, 2009 at 1:34 am.
Gimme reputation points if u find my post helpful.
use [code] tags wherever applicable
dont start a new thread unless u cant find the topic already on forum.
mark a thread "solved" as soon as u get a solution
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 510 | Replies: 8
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC