Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    175
    Thanks
    14
    Thanked 1 Time in 1 Post

    Change Month from digit to name

    Hi,

    This query returns the year as 2009 and the month as 04. How can I have the month displayed as Apr?

    Code:
    $sql = "SELECT
    DISTINCT `volrecords`.`id`,
    EXTRACT(YEAR FROM date) AS Year,
    EXTRACT(MONTH FROM date) AS Month, firstname,lastname,SUM(hours) AS HoursWorked,areaofinterest
    FROM volrecords, hoursworked 
    WHERE `volrecords`.`id` = `hoursworked`.`vol_id` 
    AND EXTRACT(MONTH FROM date)='$month' 
    AND EXTRACT(YEAR FROM date)='$year'
    AND areaofinterest = 'Cafe'
    GROUP BY lastname";
    if(!$sql){echo "Unable to select" . mysql_error();}
    $rs = mysql_query($sql,$conn);
    if(!$rs){echo "No query" . mysql_error();}
    while($row=mysql_fetch_array($rs)){
    	echo("<tr><td>"
    	. $row['lastname'] . ", " . $row['firstname'] . "</td><td>"
    	. $row['Year'] ."</td><td>"
    	. $row['Month'] . "</td><td>"   
      	. $row['HoursWorked'] . "</td><td>"
         .$row['areaofinterest'] . "</td></tr>");     
    }
    Thanks,

    Andy

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts

  • #3
    Regular Coder
    Join Date
    Jul 2006
    Posts
    175
    Thanks
    14
    Thanked 1 Time in 1 Post
    Thank you.

    Andy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •