Please echo the query and show the actual result. We have no way to know what your program puts in your variables. The problem is often a that a programming error causes the code to construct a query that's different from what you assume.
Regards, Gavin Towey -----Original Message----- From: PJ [mailto:af.gour...@videotron.ca] Sent: Friday, July 17, 2009 1:25 PM To: Darryle Steplight Cc: MySql Subject: Re: ordering search results Here's the query: "SELECT * FROM book ORDER BY $sort $dir LIMIT $offset, $records_per_page"; $sort == 'title, sub_title'; $dir==ASC (or DESC); $offset== (any multiple of 10); $records_per_page== 10; I could let the user change these, but I decided it is simpler to keep it at 10 books/page. Only the $dir is user settable. The character set is utf8-general; (I just went through some self-torture changing all those foreign curlicues to :&cutesy_stuff; fortunately, the mysql replace() function helped - but six languages have quite a few weird accents. The title field can be fairly long - 182 chars; sub_title is 128, but it looks like I have to lengthen that too; found some truncated inputs. Another problem is the Thes - how do you exclude them from the ordering. Also: one output with just title for field returned a series of The Art.., The Birds..., The Birth...etc. in ASC; whereas DESC returned: Boats, Black Cumin, Birds of..., Biological..., Bioarchaeology.., Avaris... etc. Darryle Steplight wrote: > You might have to change the collation you are currently using to one > that best match the language of those weird accents you are referring > too. That's part of the reason you may be getting unexpected results > with your ORDER BY statement. Also, can you show us your select > statements? > > On Fri, Jul 17, 2009 at 11:06 AM, PJ<af.gour...@videotron.ca> wrote: > >> Can't find anything on the web that deals with my problem(s). >> I have to display thousands of book listings by title, sub_title with 10 >> books per page. The php/mysql code works fine - except: >> ASC or DESC does not change one iota. >> I have checked by commandline and find that it is not working at all how >> I would expect. >> From commandline, using just title and switching between ASC & DESC give >> totally different results rather than displaying the same data in >> reverse order. >> The display is, as mentioned above, 10 books per output page: so, from >> what appears to me, the ordering seems to be done on the entire db & not >> just on the search results (this is basically from a SELECT statement). >> Furthermore, not all the data is in 1 table; authors, categories & >> publishers are in separate tables because of 1 to many & many to 1 >> relationships. >> Still another problem is the use of a number of foreign languages which >> have those strange accent on many letters that do not order very well. >> Now, that I have spewed out my problems, would it be possible that there >> is someone out there who could suggest how to go about figuring this out? >> Thanks in advance. >> >> -- >> Herv� Kempf: "Pour sauver la plan�te, sortez du capitalisme." >> ------------------------------------------------------------- >> Phil Jourdan --- p...@ptahhotep.com >> � http://www.ptahhotep.com >> � http://www.chiccantine.com/andypantry.php >> >> >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: � �http://lists.mysql.com/mysql?unsub=dstepli...@gmail.com >> -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." ------------------------------------------------------------- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=gto...@ffn.com The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.