473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

date matching

I'm trying to search my db and display everyone who has a birthday
that month. I fixed the forever loop and it displaying people without
a birthdate entered. The problem is it keeps changing the currentmonth
variable.

function displayBirthdays($connect, $db_table4)
{
$currentmonth = date("m");
$currentday = date("d");

$sql = "SELECT dob, lastName, firstName FROM $db_table4";
$result = mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
while ($row = mysql_fetch_array($result))
{
$lastname = $row["lastName"];
$firstname = "***";
$dob = $row['dob'];
$month = substr($dob,0,2);
$day = substr($dob,3,2);
if ($currentmonth = $month AND $month != 00)
{
echo "$month";
echo "$currentmonth";
echo"$firstname $lastname [$day]<BR>";
}
}
}

0606*** Whitfield [22]
0303*** Scanlan [09]
1111*** Whitfield [29]
0303*** Shive [15]
0808*** Keckeisen [22]
0505*** sookram [06]

Jul 17 '07 #1
3 1666
Rik
Why the repost?

--
Rik Wasmus
Jul 17 '07 #2
Rik wrote:
Why the repost?
Boredom is a terrible thing. ;-)
Jul 17 '07 #3
Rik
On Wed, 18 Jul 2007 01:08:40 +0200, JackM <no***@earthlink.netwrote:
Rik wrote:
>Why the repost?
Boredom is a terrible thing. ;-)
Damn, you've got me :-). Just lurking, waiting for something to post
indeed. Well, it's better then trolling anyway :P.

--
Rik Wasmus
Jul 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gleep | last post by:
Hey Guys, I've got a table called Outcomes. With 3 columns and 15 rows 1st col 2nd col 3rdcol outcome date price There are 15 rows...
14
by: Steve Wright | last post by:
I am trying to validate if an entry on a form is a date. I have adapted code I found here http://www.codingforums.com/archive/index.php/t-14325 as below but I can't seem the get the results that I...
4
by: yasaswi | last post by:
Now that MySQL 5.0.15 is production ready, are there any functions to use with mysqlimport, so I can load a string such as, MM/dd/yy, in a text file into a MySQL database as a yyyy-MM-dd date...
7
by: joeyej | last post by:
How do I compare today's date with this string (in my inc file) so that I can set an alert if date choice i.e. May 15, 2006 not at least greater than two days from current date? <option...
1
by: joeyej | last post by:
I'm using this code to make sure users are unable to choose a date from a drop list (<option value="June 8, 2006, (Thursday), 9am">June 12, 2006, (Thursday), 9am) that is less than two days out...
3
by: pbaugh | last post by:
Hi Folks I have a query on an Access database that has the WHERE clause : WHERE Trans.TransDate LIKE '08/04/2006*' It works fine when run in Access and returns the correct 10 rows. However, if...
1
by: Twanne | last post by:
Hi, I've got this query returning Longfunction and Parameters for some patients. I select all longfunctions and when there is a matching date the parameter is displayed. But now I would like to...
10
by: kyosohma | last post by:
Hi, I am working on a timesheet application in which I need to to find the first pay period in a month that is entirely contained in that month to calculate vacation time. Below are some example...
1
by: shafq7 | last post by:
Hello Iam trying to find a date from table "taqrir" matching to date in unbound text box in form by this code as below: Private Sub cmdAppend_Click() Dim dbs As Database Dim rs As...
4
by: Nathan Sokalski | last post by:
When determining whether a String can be converted to a DateTime, you can use the IsDate() method. However, I would also like to know whether the string is a date, a time, or both a date and a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.