problem in fetching date from database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bandy
    New Member
    • Mar 2010
    • 25

    problem in fetching date from database

    There is a date column in database table in the format as "2010-05-12 15:35:08". I am trying to fetch this field using:
    Code:
     while($res =  mysql_fetch_array($sql))
      {
       $data = $res['LoginDate']; 
      }
    It does not work.
  • chathura86
    New Member
    • May 2007
    • 227

    #2
    What was the output you got? Are you sure that you have records for the query? Try the below and post the result:
    Code:
     while($res =  mysql_fetch_array($sql))
      {
       var_dump($res); 
      }
    Last edited by Niheel; May 21 '10, 12:58 AM. Reason: Punctuation and readability

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Originally posted by bandy
      Hi there,

      There is a date column in database table in the format as "2010-05-12 15:35:08"

      Iam trying to fetch this field using
      Code:
       while($res =  mysql_fetch_array($sql))
        {
         $data = $res['LoginDate']; 
        }
      not able to get it.

      Please help
      Hey.

      You will have to be more specific. What you posted is far from being enough for us to actually reply with anything useful. We need details, like:

      What did you expect this to do? What did it actually do?
      Did you get any errors? Warnings? (Are they even turned on?)

      Comment

      Working...