Re: PHP query on "date" field

From: Date: Tue, 30 Oct 2001 20:19:42 +0000
Subject: Re: PHP query on "date" field
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-13861@lists.php.net to get a copy of this message
Ok well I have made the changes and tested it out but using the search string 10/15/2001 still provided no results... here is the script that parses the date for entry into the database... $date = (date("m/d/Y")) ; #this date is used in the online database $A = (date("A")); $Hou = (date("H")); if ($Hou == 00){ $Hou = "10"; $format = "PM"; } if ($Hou == 01){ $Hou = "11"; $format = "PM"; } if ($Hou == 02){ $Hou = "12"; $format = "AM"; } if ($Hou == 03){ $Hou = "01"; $format = "AM"; } if ($Hou == 04){ $Hou = "02"; $format = "AM"; } if ($Hou == 05){ $Hou = "03"; $format = "AM"; } if ($Hou == 06){ $Hou = "04"; $format = "AM"; } if ($Hou == 07){ $Hou = "05"; $format = "AM"; } if ($Hou == 08){ $Hou = "06"; $format = "AM"; } if ($Hou == 09){ $Hou = "07"; $format = "AM"; } if ($Hou == 10){ $Hou = "08"; $format = "AM"; } if ($Hou == 11){ $Hou = "09"; $format = "AM"; } if ($Hou == 12){ $Hou = "10"; $format = "AM"; } if ($Hou == 13){ $Hou = "11"; $format = "AM"; } if ($Hou == 14){ $Hou = "12"; $format = "PM"; } if ($Hou == 15){ $Hou = "01"; $format = "PM"; } if ($Hou == 16){ $Hou = "02"; $format = "PM"; } if ($Hou == 17){ $Hou = "03"; $format = "PM"; } if ($Hou == 18){ $Hou = "04"; $format = "PM"; } if ($Hou == 19){ $Hou = "05"; $format = "PM"; } if ($Hou == 20){ $Hou = "06"; $format = "PM"; } if ($Hou == 21){ $Hou = "07"; $format = "PM"; } if ($Hou == 22){ $Hou = "08"; $format = "PM"; } if ($Hou == 23){ $Hou = "09"; $format = "PM"; } I am wondering if I should let the date be put into the db as 2001-15-10... <biorn@ebmstpa.com> wrote in message news:200110301857.LAA04270@ns.ebmstpa.com... > Isn't date a reserved word that should not be used as a field name? It > appeared that what was asked was if he should change the name of his field > from date to date_1. It should definitely be changed if it is now called > date. > > > Jason Wong <phplist@gremlins.com.hk> said: > > > On Wednesday 31 October 2001 01:31 am, Jason wrote: > > > > > Here is my problem once again... =P I am wondering if I should change > > > the date table to something other than date... maybe something like > > > date_1? Would doing that resolve my issue, because of the fact that > > > the date variable in php is function? Thanks in advance... > > > > What is the format of date as defined in your database? If date is of > > type DATE or DATETIME then > > > > > $result = mysql_query ("SELECT * FROM ads > > > WHERE fname LIKE '%$fname%' AND lname LIKE > > > '%$lname%' AND phonea LIKE '%$phonea%' AND phone LIKE > > > '%$phone%' AND > > > date LIKE '%$date%'"); > > > > should be changed to: > > > > $result = mysql_query ("SELECT * FROM ads > > WHERE fname LIKE '%$fname%' > > AND lname LIKE '%$lname%' > > AND phonea LIKE '%$phonea%' > > AND phone LIKE '%$phone%' > > AND date = '$date'" > > ); > > hth > > -- > > Jason Wong > > Gremlins Associates > > www.gremlins.com.hk > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > > >

« previous php.db (#13861) next »