Closed Thread
Results 1 to 4 of 4

Thread: MYSql: the, and, etc...

  1. #1
    BASHERS33 is offline Programmer
    Join Date
    Apr 2009
    Posts
    196
    Rep Power
    0

    MYSql: the, and, etc...

    Is there an easy way when ordering to have titles beginning with "the " or "a " to be ordered by the following word, or do I need to do it with my programming.

    At this point I have been considering maybe having the title have one box for "the" or "a" instead of the title entered all in one box on the form and then when adding it to the DB have a field storing it and so the main field won't start with it.

    But if there is some better way to do it, I guess it would be nice knowing. Someone could always enter it with ,the at the end and then the program rearrange it for display, but some tricky things could come up in that case too and plus there would be some words I wouldn't think of to check for at beginnings which also may be better off left out when ordering.

    Ordering with the PHP itself is definitely not an dieal option because I am pulling rows with a limit and so I would have to change it and pull every row to even be sure which ones should show and it would be a mess that way.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: MYSql: the, and, etc...

    I would actually consider two solutions.
    one is to put a prefix field with the "The" or "a" in, or, save the titles as "Stone, The" and "Wedding, a" as many library records store their book titles in...
    if you want it correct, you can always have a function that moves a trailing ", The" etc to the front for printout...
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  4. #3
    BASHERS33 is offline Programmer
    Join Date
    Apr 2009
    Posts
    196
    Rep Power
    0

    Re: MYSql: the, and, etc...

    Yeah that's what I was thinking of doing, but was just being sure there was no built in mysql feature to have it automatically omit certain words when ordering. I guess not though, so I will do it some other way. Since some titles of movies have commas in them I probably should just put a separate input on the form for prefixes and then use the php to thus know if a prefix is needed. Then it would be easy.

  5. #4
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: MYSql: the, and, etc...

    Sure movies might have commas, but they would probably not end by ", The" or ", A". you just do a new table of suffixes to move, and then a couple of functions that automatically move them back and forth
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Use PDO for mysql or standar mysql functions?
    By lol33d in forum PHP Development
    Replies: 7
    Last Post: 05-07-2011, 08:41 PM
  2. Replies: 1
    Last Post: 10-20-2010, 12:38 AM
  3. [C#]MySQL] Host '****' is not allowed to connect to this MySQL server
    By ZaroX in forum Database & Database Programming
    Replies: 2
    Last Post: 02-16-2010, 08:34 PM
  4. Replies: 0
    Last Post: 01-26-2009, 11:14 AM
  5. MYSQL CheatSheet - A must for MySQL Users
    By reachpradeep in forum Database & Database Programming
    Replies: 1
    Last Post: 03-03-2007, 01:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts