|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi all, I'm not a programmer AT ALL, but I've managed to set up a
website that uses PHP to query a MySQL database for a very basic output of data. My apologies in advance for any use of incorrect terminology! The one thing I still haven't managed is to sort the resulting array according to a predefined list. I have two fields I'd like to sort on, "month_in" (a text field) and "day_in" (number field). I'd like to sort by month (as seen below), and then by day. The example below is my attempt at the solution,based on a Google search for an answer, but it's obviously not working. Any would be GREATLY appreciated! Lanse $the_query = 'SELECT * FROM `requests` ORDER BY find_in_set(month_in, 'May','June','July','August','September'), `day_in` ASC; $results = mysql_query($the_query, $dbh); |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Lanse wrote:
> Hi all, I'm not a programmer AT ALL, but I've managed to set up a > website that uses PHP to query a MySQL database for a very basic > output of data. My apologies in advance for any use of incorrect > terminology! > > The one thing I still haven't managed is to sort the resulting array > according to a predefined list. I have two fields I'd like to sort > on, "month_in" (a text field) and "day_in" (number field). I'd like > to sort by month (as seen below), and then by day. The example below > is my attempt at the solution,based on a Google search for an answer, > but it's obviously not working. Any would be GREATLY > appreciated! > > Lanse > > $the_query = > 'SELECT * FROM `requests` > ORDER BY find_in_set(month_in, > 'May','June','July','August','September'), `day_in` ASC; > $results = mysql_query($the_query, $dbh); > I would think you would be better off having a DATE column and just sort by that column. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Apr 1, 9:42am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Lanse wrote: > > Hi all, I'm not a programmer AT ALL, but I've managed to set up a > > website that uses PHP to query a MySQL database for a very basic > > output of data. My apologies in advance for any use of incorrect > > terminology! > > > The one thing I still haven't managed is to sort the resulting array > > according to a predefined list. I have two fields I'd like to sort > > on, "month_in" (a text field) and "day_in" (number field). I'd like > > to sort by month (as seen below), and then by day. The example below > > is my attempt at the solution,based on a Google search for an answer, > > but it's obviously not working. Any would be GREATLY > > appreciated! > > > Lanse > > > $the_query = > > 'SELECT * FROM `requests` > > ORDER BY find_in_set(month_in, > > 'May','June','July','August','September'), `day_in` ASC; > > $results = mysql_query($the_query, $dbh); > > I would think you would be better off having a DATE column and just sort > by that column. > > -- > ================== > Remove the "x" from my email address > Jerry Stuckle > JDS Computer Training Corp. > jstuck...@attglobal.net > ================== Yes, but my html form just has a month input field and a day input field... it's for selecting from a small, preset group of dates... |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote:
> On Apr 1, 9:42am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> Lanse wrote: >> > Hi all, I'm not a programmer AT ALL, but I've managed to set up a >> > website that uses PHP to query a MySQL database for a very basic >> > output of data. My apologies in advance for any use of incorrect >> > terminology! >> >> > The one thing I still haven't managed is to sort the resulting array >> > according to a predefined list. I have two fields I'd like to sort >> > on, "month_in" (a text field) and "day_in" (number field). I'd like >> > to sort by month (as seen below), and then by day. The example below >> > is my attempt at the solution,based on a Google search for an answer, >> > but it's obviously not working. Any would be GREATLY >> > appreciated! >> >> > Lanse >> >> > $the_query = >> > 'SELECT * FROM `requests` >> > ORDER BY find_in_set(month_in, >> > 'May','June','July','August','September'), `day_in` ASC; >> > $results = mysql_query($the_query, $dbh); >> >> I would think you would be better off having a DATE column and just sort >> by that column. >> >> -- >> ================== >> Remove the "x" from my email address >> Jerry Stuckle >> JDS Computer Training Corp. >> jstuck...@attglobal.net >> ================== > > Yes, but my html form just has a month input field and a day input > field... it's for selecting from a small, preset group of dates... Months still got numbers, even if you're starting at 5 instead of 1. Let's back up a bit. What problem are you trying to solve? Do you only want to see stuff with dates five months out? Or in a certain range? -- Usenet should require licenses; licenses that can be revoked. -- Abigail |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Apr 1, 2:10pm, "Peter H. Coffin" <hell...@ninehells.com> wrote:
> On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote: > > On Apr 1, 9:42am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > >> Lanse wrote: > >> > Hi all, I'm not a programmer AT ALL, but I've managed to set up a > >> > website that uses PHP to query a MySQL database for a very basic > >> > output of data. My apologies in advance for any use of incorrect > >> > terminology! > > >> > The one thing I still haven't managed is to sort the resulting array > >> > according to a predefined list. I have two fields I'd like to sort > >> > on, "month_in" (a text field) and "day_in" (number field). I'd like > >> > to sort by month (as seen below), and then by day. The example below > >> > is my attempt at the solution,based on a Google search for an answer, > >> > but it's obviously not working. Any would be GREATLY > >> > appreciated! > > >> > Lanse > > >> > $the_query = > >> > 'SELECT * FROM `requests` > >> > ORDER BY find_in_set(month_in, > >> > 'May','June','July','August','September'), `day_in` ASC; > >> > $results = mysql_query($the_query, $dbh); > > >> I would think you would be better off having a DATE column and just sort > >> by that column. > > >> -- > >> ================== > >> Remove the "x" from my email address > >> Jerry Stuckle > >> JDS Computer Training Corp. > >> jstuck...@attglobal.net > >> ================== > > > Yes, but my html form just has a month input field and a day input > > field... it's for selecting from a small, preset group of dates... > > Months still got numbers, even if you're starting at 5 instead of 1. > > Let's back up a bit. What problem are you trying to solve? Do you only > want to see stuff with dates five months out? Or in a certain range? > > -- > Usenet should require licenses; licenses that can be revoked. > -- Abigail Sorry for not being very clear... The webpage form is for submitting reservations for a small campsite, only available May to September. I made the Month field 'user- friendly' by using month names instead of numbers... therefore my dilemma. I can change the page to use numbers... I just hoped there'd be a simple MySQL way of re-ordering based on a fixed list of values (like "May, June, July, August, September"). The database is cleared each year, so there's no need for a 'year' value. TIA, Lanse |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Lanse wrote:
> On Apr 1, 2:10 pm, "Peter H. Coffin" <hell...@ninehells.com> wrote: >> On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote: >> > On Apr 1, 9:42 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> >> Lanse wrote: >> >> > Hi all, I'm not a programmer AT ALL, but I've managed to set up >> >> > a website that uses PHP to query a MySQL database for a very >> >> > basic output of data. My apologies in advance for any use of >> >> > incorrect terminology! >> >> >> > The one thing I still haven't managed is to sort the resulting >> >> > array according to a predefined list. I have two fields I'd >> >> > like to sort on, "month_in" (a text field) and "day_in" (number >> >> > field). I'd like to sort by month (as seen below), and then by >> >> > day. The example below is my attempt at the solution,based on a >> >> > Google search for an answer, but it's obviously not working. >> >> > Any would be GREATLY appreciated! >> >> >> > Lanse >> >> >> > $the_query = >> >> > 'SELECT * FROM `requests` >> >> > ORDER BY find_in_set(month_in, >> >> > 'May','June','July','August','September'), `day_in` ASC; >> >> > $results = mysql_query($the_query, $dbh); >> >> >> I would think you would be better off having a DATE column and >> >> just sort by that column. >> >> >> -- >> >> ================== >> >> Remove the "x" from my email address >> >> Jerry Stuckle >> >> JDS Computer Training Corp. >> >> jstuck...@attglobal.net >> >> ================== >> >> > Yes, but my html form just has a month input field and a day input >> > field... it's for selecting from a small, preset group of dates... >> >> Months still got numbers, even if you're starting at 5 instead of 1. >> >> Let's back up a bit. What problem are you trying to solve? Do you >> only want to see stuff with dates five months out? Or in a certain >> range? >> >> -- >> Usenet should require licenses; licenses that can be revoked. >> -- Abigail > > Sorry for not being very clear... > The webpage form is for submitting reservations for a small campsite, > only available May to September. I made the Month field 'user- > friendly' by using month names instead of numbers... therefore my > dilemma. I can change the page to use numbers... I just hoped there'd > be a simple MySQL way of re-ordering based on a fixed list of values > (like "May, June, July, August, September"). The database is cleared > each year, so there's no need for a 'year' value. > > TIA, Lanse Store the months as numbers but display as words (using a Select box for instance) |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On Apr 1, 4:10pm, "Paul Lautman" <paul.laut...@btinternet.com> wrote:
> Lanse wrote: > > On Apr 1, 2:10 pm, "Peter H. Coffin" <hell...@ninehells.com> wrote: > >> On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote: > >> > On Apr 1, 9:42 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > >> >> Lanse wrote: > >> >> > Hi all, I'm not a programmer AT ALL, but I've managed to set up > >> >> > a website that uses PHP to query a MySQL database for a very > >> >> > basic output of data. My apologies in advance for any use of > >> >> > incorrect terminology! > > >> >> > The one thing I still haven't managed is to sort the resulting > >> >> > array according to a predefined list. I have two fields I'd > >> >> > like to sort on, "month_in" (a text field) and "day_in" (number > >> >> > field). I'd like to sort by month (as seen below), and then by > >> >> > day. The example below is my attempt at the solution,based on a > >> >> > Google search for an answer, but it's obviously not working. > >> >> > Any would be GREATLY appreciated! > > >> >> > Lanse > > >> >> > $the_query = > >> >> > 'SELECT * FROM `requests` > >> >> > ORDER BY find_in_set(month_in, > >> >> > 'May','June','July','August','September'), `day_in` ASC; > >> >> > $results = mysql_query($the_query, $dbh); > > >> >> I would think you would be better off having a DATE column and > >> >> just sort by that column. > > >> >> -- > >> >> ================== > >> >> Remove the "x" from my email address > >> >> Jerry Stuckle > >> >> JDS Computer Training Corp. > >> >> jstuck...@attglobal.net > >> >> ================== > > >> > Yes, but my html form just has a month input field and a day input > >> > field... it's for selecting from a small, preset group of dates... > > >> Months still got numbers, even if you're starting at 5 instead of 1. > > >> Let's back up a bit. What problem are you trying to solve? Do you > >> only want to see stuff with dates five months out? Or in a certain > >> range? > > >> -- > >> Usenet should require licenses; licenses that can be revoked. > >> -- Abigail > > > Sorry for not being very clear... > > The webpage form is for submitting reservations for a small campsite, > > only available May to September. I made the Month field 'user- > > friendly' by using month names instead of numbers... therefore my > > dilemma. I can change the page to use numbers... I just hoped there'd > > be a simple MySQL way of re-ordering based on a fixed list of values > > (like "May, June, July, August, September"). The database is cleared > > each year, so there's no need for a 'year' value. > > > TIA, Lanse > > Store the months as numbers but display as words (using a Select box for > instance) OK, I understand how to do the html for the Submit side of things, where the displayed info is text, and the submitted value is a number. But then I'm displaying the query results from the database... so I convert the numbers back to the text format? My skills are very meager there... Lanse |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
>Sorry for not being very clear...
>The webpage form is for submitting reservations for a small campsite, >only available May to September. I made the Month field 'user- >friendly' by using month names instead of numbers... therefore my If you are using HTML "SELECT", you can present user-friendly choices on the page (month names in the language of the user), *AND* give "machine-friendly" values (month numbers) back to the web server. >dilemma. I can change the page to use numbers... I just hoped there'd >be a simple MySQL way of re-ordering based on a fixed list of values >(like "May, June, July, August, September"). The database is cleared >each year, so there's no need for a 'year' value. I recommend you put the month, day, and current year in a DATE field. Then you can order by it, and do other stuff like day-of-the-week calculations easily, and use GROUP BY to determine how many reservations there are for a given day, to see if you have any slots available. If you need to present a date to the user, in MySQL there's date_format(), and a bunch of functions in script languages like PHP or Perl. I recommend displaying the day of the week, too, which may make users think twice if they are making a reservation looking at a calendar for the wrong month. It's impossible for someone to make a reservation in October for next May? Perhaps always using the current year needs to be examined closer. |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
On Tue, 1 Apr 2008 12:16:28 -0700 (PDT), Lanse wrote:
> On Apr 1, 2:10pm, "Peter H. Coffin" <hell...@ninehells.com> wrote: >> On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote: >> > On Apr 1, 9:42am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >> >> Lanse wrote: [...] >> >> > $the_query = >> >> > 'SELECT * FROM `requests` >> >> > ORDER BY find_in_set(month_in, >> >> > 'May','June','July','August','September'), `day_in` ASC; >> >> > $results = mysql_query($the_query, $dbh); >> >> >> I would think you would be better off having a DATE column and just sort >> >> by that column. >> >> >> -- >> >> ================== >> >> Remove the "x" from my email address >> >> Jerry Stuckle >> >> JDS Computer Training Corp. >> >> jstuck...@attglobal.net >> >> ================== >> >> > Yes, but my html form just has a month input field and a day input >> > field... it's for selecting from a small, preset group of dates... >> >> Months still got numbers, even if you're starting at 5 instead of 1. >> >> Let's back up a bit. What problem are you trying to solve? Do you only >> want to see stuff with dates five months out? Or in a certain range? > > Sorry for not being very clear... > The webpage form is for submitting reservations for a small campsite, > only available May to September. I made the Month field 'user- > friendly' by using month names instead of numbers... therefore my > dilemma. I can change the page to use numbers... I just hoped there'd > be a simple MySQL way of re-ordering based on a fixed list of values > (like "May, June, July, August, September"). The database is cleared > each year, so there's no need for a 'year' value. Being clear innit really the issue. The explanation was clear, just ... kind of asking too specific a question. There's two ways to attack this issue, one a programming one and the other a database one, both center on the idea that months have both names and ordinal numbers. The programming one is a little easier for most folks to grasp, and that is that you stuff the numbers for the month into the database and when you're dealing with the user, you look at the number of the month and print the appropriate name if ($mysq_result['month'] == 5) { print "May" } elseif($mysq_result['month'] == 6) { print "June" } elseif($mysq_result['month'] == 7) { print "July" } elseif($mysq_result['month'] == 8) { print "August" } elseif($mysq_result['month'] == 9) { print "September" } else print "Smarch"; A pure database way of dealing with it would be to have a table with columns for month number and month name, and make your query look something like SELECT name, month_name, day_in from `requests` JOIN `months` on `requests`.month_in = month_number ORDER BY month_in, day_in The nice thing then is that whenever the names of the months change, you don't have to change the program. This may not seem very useful for month names, but just wait until you start fussing with things that DO change, like the designation of campsites or something. ("Hey, lets name all the sites after trees!" Update your site_number,site_name table and it's all done.) -- 87. My vats of hazardous chemicals will be covered when not in use. Also, I will not construct walkways above them. --Peter Anspach's list of things to do as an Evil Overlord |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
On Apr 1, 5:24pm, "Peter H. Coffin" <hell...@ninehells.com> wrote:
> On Tue, 1 Apr 2008 12:16:28 -0700 (PDT), Lanse wrote: > > On Apr 1, 2:10pm, "Peter H. Coffin" <hell...@ninehells.com> wrote: > >> On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote: > >> > On Apr 1, 9:42am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > >> >> Lanse wrote: > [...] > >> >> > $the_query = > >> >> > 'SELECT * FROM `requests` > >> >> > ORDER BY find_in_set(month_in, > >> >> > 'May','June','July','August','September'), `day_in` ASC; > >> >> > $results = mysql_query($the_query, $dbh); > > >> >> I would think you would be better off having a DATE column and just sort > >> >> by that column. > > >> >> -- > >> >> ================== > >> >> Remove the "x" from my email address > >> >> Jerry Stuckle > >> >> JDS Computer Training Corp. > >> >> jstuck...@attglobal.net > >> >> ================== > > >> > Yes, but my html form just has a month input field and a day input > >> > field... it's for selecting from a small, preset group of dates... > > >> Months still got numbers, even if you're starting at 5 instead of 1. > > >> Let's back up a bit. What problem are you trying to solve? Do you only > >> want to see stuff with dates five months out? Or in a certain range? > > > Sorry for not being very clear... > > The webpage form is for submitting reservations for a small campsite, > > only available May to September. I made the Month field 'user- > > friendly' by using month names instead of numbers... therefore my > > dilemma. I can change the page to use numbers... I just hoped there'd > > be a simple MySQL way of re-ordering based on a fixed list of values > > (like "May, June, July, August, September"). The database is cleared > > each year, so there's no need for a 'year' value. > > Being clear innit really the issue. The explanation was clear, just ... > kind of asking too specific a question. > > There's two ways to attack this issue, one a programming one and the > other a database one, both center on the idea that months have both > names and ordinal numbers. The programming one is a little easier for most > folks to grasp, and that is that you stuff the numbers for the month > into the database and when you're dealing with the user, you look at the > number of the month and print the appropriate name > > if ($mysq_result['month'] == 5) { print "May" } > elseif($mysq_result['month'] == 6) { print "June" } > elseif($mysq_result['month'] == 7) { print "July" } > elseif($mysq_result['month'] == 8) { print "August" } > elseif($mysq_result['month'] == 9) { print "September" } > else print "Smarch"; > > A pure database way of dealing with it would be to have a table with > columns for month number and month name, and make your query look > something like > > SELECT name, month_name, day_in from `requests` JOIN `months` > on `requests`.month_in = month_number > ORDER BY month_in, day_in > > The nice thing then is that whenever the names of the months change, you > don't have to change the program. This may not seem very useful for > month names, but just wait until you start fussing with things that DO > change, like the designation of campsites or something. ("Hey, lets name > all the sites after trees!" Update your site_number,site_name table and > it's all done.) > > -- > 87. My vats of hazardous chemicals will be covered when not in use. Also, I > will not construct walkways above them. > --Peter Anspach's list of things to do as an Evil Overlord You guys are great! Thanks so much for the kind assistance. I think I have enough knowledge now to get it done. And who knows, I may learn a little more along the way. thanks again, Lanse |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
Lanse wrote:
> On Apr 1, 2:10 pm, "Peter H. Coffin" <hell...@ninehells.com> wrote: >> On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote: >>> On Apr 1, 9:42 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: >>>> Lanse wrote: >>>>> Hi all, I'm not a programmer AT ALL, but I've managed to set up a >>>>> website that uses PHP to query a MySQL database for a very basic >>>>> output of data. My apologies in advance for any use of incorrect >>>>> terminology! >>>>> The one thing I still haven't managed is to sort the resulting array >>>>> according to a predefined list. I have two fields I'd like to sort >>>>> on, "month_in" (a text field) and "day_in" (number field). I'd like >>>>> to sort by month (as seen below), and then by day. The example below >>>>> is my attempt at the solution,based on a Google search for an answer, >>>>> but it's obviously not working. Any would be GREATLY >>>>> appreciated! >>>>> Lanse >>>>> $the_query = >>>>> 'SELECT * FROM `requests` >>>>> ORDER BY find_in_set(month_in, >>>>> 'May','June','July','August','September'), `day_in` ASC; >>>>> $results = mysql_query($the_query, $dbh); >>>> I would think you would be better off having a DATE column and just sort >>>> by that column. >>>> -- >>>> ================== >>>> Remove the "x" from my email address >>>> Jerry Stuckle >>>> JDS Computer Training Corp. >>>> jstuck...@attglobal.net >>>> ================== >>> Yes, but my html form just has a month input field and a day input >>> field... it's for selecting from a small, preset group of dates... >> Months still got numbers, even if you're starting at 5 instead of 1. >> >> Let's back up a bit. What problem are you trying to solve? Do you only >> want to see stuff with dates five months out? Or in a certain range? >> >> -- >> Usenet should require licenses; licenses that can be revoked. >> -- Abigail > > Sorry for not being very clear... > The webpage form is for submitting reservations for a small campsite, > only available May to September. I made the Month field 'user- > friendly' by using month names instead of numbers... therefore my > dilemma. I can change the page to use numbers... I just hoped there'd > be a simple MySQL way of re-ordering based on a fixed list of values > (like "May, June, July, August, September"). The database is cleared > each year, so there's no need for a 'year' value. > > TIA, Lanse > Not a problem. Just because you have a month field and a date field on the form doesn't mean you need to use them in the database. I virtually always use January-December and a day of month. But when the form is submitted I convert it to a date for storing in the database. It makes things a lot easier all around - for instance, reserving a campsite on June 28th for 7 nights can be handled with standard date functions in either MySQL or PHP. Your way makes things much harder. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
On 1 Apr, 21:08, Lanse <filema...@jillo.com> wrote:
> On Apr 1, 4:10 pm, "Paul Lautman" <paul.laut...@btinternet.com> wrote: > > > > > Lanse wrote: > > > On Apr 1, 2:10 pm, "Peter H. Coffin" <hell...@ninehells.com> wrote: > > >> On Tue, 1 Apr 2008 10:19:47 -0700 (PDT), Lanse wrote: > > >> > On Apr 1, 9:42 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > > >> >> Lanse wrote: > > >> >> > Hi all, I'm not a programmer AT ALL, but I've managed to set up > > >> >> > a website that uses PHP to query a MySQL database for a very > > >> >> > basic output of data. My apologies in advance for any use of > > >> >> > incorrect terminology! > > > >> >> > The one thing I still haven't managed is to sort the resulting > > >> >> > array according to a predefined list. I have two fields I'd > > >> >> > like to sort on, "month_in" (a text field) and "day_in" (number > > >> >> > field). I'd like to sort by month (as seen below), and then by > > >> >> > day. The example below is my attempt at the solution,based on a > > >> >> > Google search for an answer, but it's obviously not working. > > >> >> > Any would be GREATLY appreciated! > > > >> >> > Lanse > > > >> >> > $the_query = > > >> >> > 'SELECT * FROM `requests` > > >> >> > ORDER BY find_in_set(month_in, > > >> >> > 'May','June','July','August','September'), `day_in` ASC; > > >> >> > $results = mysql_query($the_query, $dbh); > > > >> >> I would think you would be better off having a DATE column and > > >> >> just sort by that column. > > > >> >> -- > > >> >> ================== > > >> >> Remove the "x" from my email address > > >> >> Jerry Stuckle > > >> >> JDS Computer Training Corp. > > >> >> jstuck...@attglobal.net > > >> >> ================== > > > >> > Yes, but my html form just has a month input field and a day input > > >> > field... it's for selecting from a small, preset group of dates... > > > >> Months still got numbers, even if you're starting at 5 instead of 1. > > > >> Let's back up a bit. What problem are you trying to solve? Do you > > >> only want to see stuff with dates five months out? Or in a certain > > >> range? > > > >> -- > > >> Usenet should require licenses; licenses that can be revoked. > > >> -- Abigail > > > > Sorry for not being very clear... > > > The webpage form is for submitting reservations for a small campsite, > > > only available May to September. I made the Month field 'user- > > > friendly' by using month names instead of numbers... therefore my > > > dilemma. I can change the page to use numbers... I just hoped there'd > > > be a simple MySQL way of re-ordering based on a fixed list of values > > > (like "May, June, July, August, September"). The database is cleared > > > each year, so there's no need for a 'year' value. > > > > TIA, Lanse > > > Store the months as numbers but display as words (using a Select box for > > instance) > > OK, I understand how to do the html for the Submit side of things, > where the displayed info is text, and the submitted value is a > number. But then I'm displaying the query results from the > database... so I convert the numbers back to the text format? My > skills are very meager there... > > Lanse Join to a table containing the the month name and number. Or do as Jerry suggested and store all the entries as dates in a single (hard coded) year. Then you can use the FORMAT_DATE and associated date functions to display in whatever format you like. |
|
![]() |
| Outils de la discussion | |
|
|