![]() Topic awaiting preservation: PHP - convert month name to number (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: there...no..there..... |
![]() That is part of the question. Here is what I am doing. code: //connect to the database
|
Paranoid (IV) Inmate From: New Jersey, USA |
![]() CPrompt code: $this_month = '';
|
Maniac (V) Inmate From: there...no..there..... |
![]() Butcher, |
Paranoid (IV) Inmate From: New Jersey, USA |
![]() You've alread got that done. |
Maniac (V) Inmate From: there...no..there..... |
![]() 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 |
![]() or you could simply make use of php->date() |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
![]() 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 |
![]() 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..... |
![]() yeah Butcher is correct. That is exactly what I needed to do. Going to take a look at the statment though. |