473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Re: dynamic drop down list from the date field filtered to uniquemonths

You don't have to use DISTINCT on the full date, for example to get
the distinct months use something like:

SELECT DISTINCT MONTHNAME(date_field) AS Months
or a PHP solution may use the array_unique() function on your db
result set
Jun 27 '08 #1
7 1431
On Jun 8, 5:20 am, macca <ptmcna...@googlemail.comwrote:
You don't have to use DISTINCT on the full date, for example to get
the distinct months use something like:

SELECT DISTINCT MONTHNAME(date_field) AS Months

or a PHP solution may use the array_unique() function on your db
result set
Thank you i will give it a shot.

God bless
jsd219
Jun 27 '08 #2
That worked, thank you very much...i do have one more issue to deal
with now. the value of the month is August or July. how would i go
about converting that back to an integer. ie 06, 07? I tried changing
the DISTINCT from MONTHNAME to MONTH and that gives me the integer but
then i need a variable to change that integer into the Month Name.
Either way i go about it i need an additional variable that converts
my query value to the opposite of what i pulled. I hope this makes
sense. :)

God bless
jsd219
Jun 27 '08 #3
jsd219 wrote:
That worked, thank you very much...i do have one more issue to deal
with now. the value of the month is August or July. how would i go
about converting that back to an integer. ie 06, 07? I tried changing
the DISTINCT from MONTHNAME to MONTH and that gives me the integer but
then i need a variable to change that integer into the Month Name.
Either way i go about it i need an additional variable that converts
my query value to the opposite of what i pulled. I hope this makes
sense. :)

God bless
jsd219
These are SQL questions, and should be asked in the appropriate database
newsgroup, i.e. comp.databases.mysql for MySQL.

You'll get much better answers there - that's where the database experts
hang out.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #4
You should look up date() in the manual, for example:

<?php

echo date('F',strtotime('01')); //Prints January

echo date('m',strtotime('January')); //Prints 01

?>
Jun 27 '08 #5
It's not hard to convert the monthname to month:

echo date('m',strtotime('March')); //Prints 03

echo date('m',strtotime('august')); //Prints 08
Jun 27 '08 #6
macca wrote:
It's not hard to convert the monthname to month:

echo date('m',strtotime('March')); //Prints 03

echo date('m',strtotime('august')); //Prints 08
And there are even better ways to do it in SQL - which is why I
recommended he try a database newsgroup.

Ask in the best group and you get the best answers.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 27 '08 #7
Thank you and Yes Jerry I agree this is now a database question
however when I originally posted it I was under the impression that I
could not do this via MySql but needed to do it through php. I will go
over to the database group and see about an easier way to do it via
MySql.

Thanks again Macca and Jerry

God bless
jsd219
Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
2
by: Nick | last post by:
Loop to create an array from a dynamic form. I'm having trouble with an application, and I'll try to explain it as clearly as possible: 1. I have a form with two fields, say Apples and...
3
by: Robert Mark Bram | last post by:
Hi All! Has anyone seen an example of the following javascript powered control: - a dropdown select menu - the width of the control is set. Assume by "control" I mean the visible part of the...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
1
by: sparks | last post by:
I have a main table with teacher names and students I can put this in a subform and filter by teacher name so I have a list of her students in a sub form. the problem I have is this is created in...
5
by: jdzemke | last post by:
I am getting 'options' is null or not an object using when using a dynamic dataset with a dropdown list in an html form. I am filling-in a text field and filtering the values in the drop-down. ...
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
1
by: abTech | last post by:
Have struggled a lot to get a filtered drop down in the normal html and that too editable ... i have used table like auto-completion etc ... This is the simplest solution for a filtered drop down ...
1
by: ndeeley | last post by:
Okay... I've created a drop down list fed by a table. I want my users to select an item in the list, say `Awaiting Repairs`, then fill in a single date text field. When a command button is pressed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.