Jump to content

Order by month name


gavin.sibley

Recommended Posts

thanks for the reply. i have tried the code you reccomended but cant seem to get it to work, i am completely new to PHP. i cant see what im doing wrong, any idea? the code is below.

 

$getrecen = mysql_query("SELECT * FROM `temp_users` WHERE `email` NOT LIKE 'admin' AND `refresh_quote` = '1' ORDER BY active ASC, event_year ASC, FIELD(event_month,'January','February','March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', December'), event_day ASC LIMIT $LimitValue, $LIMIT") or die(mysql_error());

 

Link to comment
Share on other sites

cant seem to get it to work

 

Exactly what did it do vs what you expected?

 

A) I (we) recommend that you form you query statement in a php variable, then echo it to make sure it contains what you expect.

 

B) You should be storing your event date in one column as a mysql DATE data type (YYYY-MM-DD format.)

Link to comment
Share on other sites

i was hoping i could have the event dates in order displayed in a table. with the code as it is with the changes you suggested i get the following syntax error.

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''), event_day ASC LIMIT 0, 20' at line 1

 

 

unfortunately im not a PHP person and didnt build the site, i am having to fix it as the initial guy who built it has left.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.