| | |
birthday script
Thread Solved |
-1
#3 Nov 23rd, 2009
assuming u have a field dob (with datatype as date) in user table this query can help u...
Hope its clear..
cheers!!
PHP Syntax (Toggle Plain Text)
$current_month = date(m); $current_day = date(d); $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
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
0
#4 Nov 23rd, 2009
PHP Syntax (Toggle Plain Text)
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
•
•
Join Date: Dec 2008
Posts: 115
Reputation:
Solved Threads: 16
0
#5 Nov 23rd, 2009
PHP Syntax (Toggle Plain Text)
$result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ")
1
#6 Nov 23rd, 2009
•
•
•
•
PHP Syntax (Toggle Plain Text)
$result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ")

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..
PHP Syntax (Toggle Plain Text)
$query = "SELECT name FROM user WHERE month(dob) = ".$current_month." AND day(dob) >= ".$current_day; $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
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
-1
#7 Nov 23rd, 2009
•
•
•
•
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..
PHP Syntax (Toggle Plain Text)
$query = "SELECT name FROM user WHERE month(dob) = ".$current_month." AND day(dob) >= ".$current_day; $result = mysql_query($query);
how to format?
0
#9 Nov 24th, 2009
•
•
•
•
i want to display date format this (1989-03-09) as 9th mar 1989.
give an idea......how to format like this
PHP Syntax (Toggle Plain Text)
$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
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
![]() |
Similar Threads
- birthday reminder (PHP)
- Dehasher script malfunctioning (PHP)
- birthday (PHP)
- troubleshoot simple mysql php db script (PHP)
- Help with birthday MySQL Script (MySQL)
- age advancing script? (JavaScript / DHTML / AJAX)
Other Threads in the PHP Forum
- Previous Thread: Defining functions in an if-else statement
- Next Thread: how to use a external javascript file (like external CSS) in php
Views: 510 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for PHP
access ajax apache api array arrays beginner binary broken cakephp check checkbox class cms code combobox cron curl database date development directory display download dropdown dropdownlist echo email error file files form forms function functions google header hosting href htaccess html image include insert integration ip java javascript joomla jquery limit link list login mail menu methods mlm mod_rewrite multiple mysql oop parse password paypal php problem query random recursion regex results rewrite script search select server sessions sms soap sorting source sql storage structure syntax system table tutorial unicode update updates upload url validation variable video web xml youtube





