date matching

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • up2trouble

    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 displayBirthday s($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_arr ay($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]

  • Rik

    #2
    Re: date matching

    Why the repost?

    --
    Rik Wasmus

    Comment

    • JackM

      #3
      Re: date matching

      Rik wrote:
      Why the repost?
      >
      Boredom is a terrible thing. ;-)

      Comment

      • Rik

        #4
        Re: date matching

        On Wed, 18 Jul 2007 01:08:40 +0200, JackM <notme@earthlin k.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

        Comment

        Working...