Retrieving a date.
| From: | Ken Thompson | Date: | Sat, 02 Mar 2002 04:11:35 +0000 |
| Subject: | Retrieving a date. | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-17409@lists.php.net to get a copy of this message | ||
I have a test table with the ususal customer information in it along with a
field for the date of birth. I'm trying to return records of any customers
whose birthdates are the same day and month as the current date.
Here's the query & result:
mysql> SELECT * FROM Cinfo WHERE BirthDate = "date('m d')";
Empty set (0.00 sec)
Here's what is returned with a global query:
mysql> select * from Cinfo;
+-----------+----------+-------------------+---------+-------+--------+--------------+--------------+--------------+------------+----+
| FirstName | LastName | Address | City | State | Zip |
HomePhone | WorkPhone | CellPhone | BirthDate | id |
+-----------+----------+-------------------+---------+-------+--------+--------------+--------------+--------------+------------+----+
| Joe | Blow | 1200 High St. #12 | St.Looy | UT | 844110 |
801-111-2299 | 801-111-3456 | 801-213-8956 | 1959-03-01 | 1 |
| | | | | | |
| | | | 2 |
| | | | | | |
| | | | 3 |
| | | | | | |
| | | | 4 |
+-----------+----------+-------------------+---------+-------+--------+--------------+--------------+--------------+------------+----+
4 rows in set (0.00 sec)
I have a feeling it's the date format in the table. I tried making it a date
field but just got the current date. What am I doing wrong?
Off Topic, I saw something about resetting the auto-increment counter, but
now I can't find reference to it. Can some kind soul enlighten me???
--
Ken Thompson, North West Antique Autos
Payette, Idaho
Email: ken@nwaa.com
http://www.nwaa.com
Sales and brokering of antique autos and parts.
Linux- Coming Soon To A Desktop Near You
Registered Linux User #183936