• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

mysql date stamp

Guest
Mar 09, 2007 Mar 09, 2007

Copy link to clipboard

Copied

Hi i have a mysql date stamp in my table,

i need to do the following, can someone please help

a) a query so i can have a drop list of months generated from the datestamp

b) once i have the drop list, on my action page i need a query to select the month from the date stamp which matches the form.listbox

hope some one can help, thanks
TOPICS
Advanced techniques

Views

401

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 10, 2007 Mar 10, 2007
read this
http://www.databasejournal.com/features/mysql/article.php/2172731

start your query with "select distinct'

Votes

Translate

Translate
Participant ,
Mar 10, 2007 Mar 10, 2007

Copy link to clipboard

Copied

Here is a start to give you a concept of what you might do. Replace my hand query with your query from mysql.

<cfset myQuery = QueryNew("Time")>
<cfset newRow = QueryAddRow(MyQuery, 3)>
<cfset temp = QuerySetCell(myQuery, "Time", "{ts '2007-03-10 10:11:02'}", 1)>
<cfset temp = QuerySetCell(myQuery, "Time", "{ts '2007-04-10 10:11:02'}", 2)>
<cfset temp = QuerySetCell(myQuery, "Time", "{ts '2007-05-10 10:11:02'}", 3)>
<select>
<cfoutput query="myQuery">
<option selected="selected" value="#DateFormat(Time, "MMMM")#">#DateFormat(Time,"MMMM")#</option>
</cfoutput>
</select>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 10, 2007 Mar 10, 2007

Copy link to clipboard

Copied

Also, you can have an if statement around your option attribute to pick the selected attribute. Something like this.
<option <cfif form.listbox EQ myQuery.Time>selected="selected" </cfif> value="#DateFormat(Time, "MMMM")#">#DateFormat(Time,"MMMM")#</option>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 10, 2007 Mar 10, 2007

Copy link to clipboard

Copied

read this
http://www.databasejournal.com/features/mysql/article.php/2172731

start your query with "select distinct'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 10, 2007 Mar 10, 2007

Copy link to clipboard

Copied

ok sorted

thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 11, 2007 Mar 11, 2007

Copy link to clipboard

Copied

LATEST
#MonthName(Now())# has to be #MonthAsString(Month(Now()))#
there is no such function MonthName() in CF...
--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation