Re: Question about Select Query VERY URGENT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How about you change it to:
 
SELECT columnname FROM tablename WHERE DATE(columnname)='$dt'

???

Should work on Mysql 4.1 and up.


-D. Israel
dan@xxxxxxxx
http://www.customcodebydan.com
AIM: JudoDanIzz 
Can you name the movie this was in:
 
'Greater good?' I am your wife! I'm the greatest 'good' you are ever gonna get!

----- Original Message ----
From: Sudhakar <finals27@xxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx
Sent: Tuesday, October 30, 2007 2:04:52 PM
Subject:  Question about Select Query VERY URGENT

I have a table in mysql which i have defined as date and the values 
that are inserted have the following format for example : 2007-10-30 
08:02:40

My requirement is to run a select query to retrieve a particular 
column on a specific date ex= "SELECT columnname from tablename 
where columnname='$dt'";

$sd=mysql_query($selectdate);
$sdr=mysql_num_rows($sd);

      if($sdr > 0) 
      { echo "Records found"
      } 
      else { 
      echo "No Records found";
      } 

This works fine only if i manually change the format of the date 
field to the following format = 2007-10-30

I have more than 2000 records in the table so its not a good idea to 
edit the dates.

MY QUESTION IS = without editing the value of the date and the value 
of the date field being 2007-10-30 08:02:40, how can i use a select 
query which would ignore 08:02:40 and consider 2007-10-30 ONLY.

I need to implement this at the earliest. Any help in this regard 
will be greatly appreciated.

Thanks.



PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links









__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux