473,394 Members | 1,800 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,394 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 1665
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.