Topic awaiting preservation: PHP - convert month name to number (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: there...no..there..... |
posted 04-16-2005 16:30
That is part of the question. Here is what I am doing. code: //connect to the database
|
Paranoid (IV) Inmate From: New Jersey, USA |
posted 04-16-2005 17:21
CPrompt code: $this_month = '';
|
Maniac (V) Inmate From: there...no..there..... |
posted 04-16-2005 17:32
Butcher, |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 04-16-2005 17:41
You've alread got that done. |
Maniac (V) Inmate From: there...no..there..... |
posted 04-16-2005 19:08
yep......did just that. I was more or less just saying what I was doing, not really a question |
Maniac (V) Mad Scientist From: :morF |
posted 04-17-2005 06:59
or you could simply make use of php->date() |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 04-17-2005 11:53
Looping through all entries in a database just to extract unique month names isn't a very good approach at doing this. Imagine if you had to loop through several thousands of entries... code: SELECT DATE_FORMAT(dEntryDate, '%Y %M') AS cYearMonth FROM blog GROUP BY cYearMonth ORDER BY dEntryDate DESC |
Paranoid (IV) Inmate From: New Jersey, USA |
posted 04-17-2005 13:18
I was under the impression that CPrompt was looping through to print out all the information returned from the query and wanted to display them all under their respective month's heading. Since each row will contain a date, many with the same month, he only needed to print the month once but still loop through all the imformation to print it out. Other wise I would have probably suggested a SELECT DISTINCT type of SQL that would just grab distinct months. |
Maniac (V) Inmate From: there...no..there..... |
posted 04-19-2005 18:46
yeah Butcher is correct. That is exactly what I needed to do. Going to take a look at the statment though. |