Ken,

If it works, it works!

If you want to store the birthdate in a single column in the db, then
make the datatype a date in CCYY-MM-DD format, then prepare the query by
asking PHP for the server's date as month (MM) and day (DD) and apply
those to the query using the functions I pointed you at earlier.

Is it 'better'? You're the best judge!
=dn




> I have the thing returning the date as long as the date format is
"m/d" in
> the table with a seperate year column.
> Here's the table:
>
> mysql> select * from Cinfo;
> +-----+--------+----------+-------+-------+
> | Cid | Fname  | Lname    | Bday  | Byear |
> +-----+--------+----------+-------+-------+
> |   1 | Lars   | Larsen   | 03/02 | 1960  |
> |   2 | Larry  | Loophole | 03/02 | 1950  |
> |   3 | Fuzzy  | Wimp     | 03/02 | 1990  |
> |   4 | Willy  | Warp     | 03/03 | 1960  |
> |   5 | Harry  | Toes     | 03/03 | 1998  |
> |   6 | Jiminy | Cricket  | 03/04 | 1889  |
> +-----+--------+----------+-------+-------+
> 6 rows in set (0.00 sec)
>
> Here's the code, I would welcome comments or improvements.
>
> $db = mysql_connect("localhost", "root");
> $Date = date("m/d");
> mysql_select_db("customers",$db);
>
> $result = mysql_query("SELECT * FROM Cinfo WHERE Bday = '$Date'");
>
> The result is sent to a table and to my surprise actually works...
> --


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to