You are here: Re: date matching « PHP Programming Language « IT news, forums, messages
Re: date matching

Posted by Harrie Verveer on 07/17/07 15:41

Hi,

I would really try to do this using MySQL (with functions like
DATE_INTERVAL) but besides that:

if ($currentmonth = $month AND $month != 00)

I think you want to compare the months ($currentmonth == $month) and not
assign $month to $currentmonth ($currentmonth = $month).

Kind regards,

Harrie Verveer
---
http://www.ibuildings.nl/blog/authors/Harrie-Verveer


up2trouble wrote:
> 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]
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация