This is what I'm saying...

I encourage you to try it and experiment.

-----Original Message-----
From: Jason [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 2:51 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] PHP query on "date" field


Just to clear some things up... so instead of the long winded bit of code
that was previously setup to change the format of the date for the date
field in the db, I should use the 2 lines of code? Definately skeptical on
this one... but you know more about this than I.

"Rick Emery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Assuming you correct the hours calculation per my previous email, then:
>
> $format = ($Hou>12?) "PM" : "AM" ;
> $Hou -= ($Hou>12?) 12 : 0;
>
> And you can do away with all the constructs.
>
> -----Original Message-----
> From: Rick Emery
> Sent: Tuesday, October 30, 2001 2:09 PM
> To: 'Jason'; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] PHP query on "date" field
>
>
> Jason,
>
> date("H") converts to a 24-hour clock.  That is, 00 is 12 mid-night, 01 is
1
> AM, 13 is 1 PM, 14 is 2 PM, 23 is 11 PM, etc.
>
> I do not understand the reasons for your computation that, say 00, is 10
PM.
>
> -----Original Message-----
> From: Jason [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 30, 2001 2:20 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] PHP query on "date" field
>
>
> 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...
>
> <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> >
> >
> >
> > --
> >
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to