craigbruiners Posted February 28, 2007 Share Posted February 28, 2007 This is the query: $tech = " select d.doc_id, d.doctype_id, d.doc_summary, d.doc_title, p.dpdf_name, doc.doctype_title, doc.doctype_img, doc.doctype_img_alt, d.doc_textversion from doctype doc,document d left join pdf p on d.dpdf_id = p.dpdf_id where d.doc_id='".base64_decode($_GET['id'])."' and d.doctype_id=doc.doctype_id order by d.doc_title asc"; Because at the moment it displays the results in any order. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/ Share on other sites More sharing options...
fenway Posted February 28, 2007 Share Posted February 28, 2007 You're going to run into trouble with that comma operator in 5.0... use inner join instead with an on clause. Anyway, I don't know what you mean about "any order" -- you have an order by clause. Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196036 Share on other sites More sharing options...
craigbruiners Posted February 28, 2007 Author Share Posted February 28, 2007 What comma Do u mean? I would like the details to display in alphabetical order eg. Aby, Andy, Bettie, Zero etc. Because at the moment its Andy, Bettie, Zero, Aby. It displays the details in any way. Thanks for ur trouble Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196096 Share on other sites More sharing options...
fenway Posted February 28, 2007 Share Posted February 28, 2007 The comma between the tables document and doctype. And what does your field doc_title contain ? because you're currently ordering by that. Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196138 Share on other sites More sharing options...
craigbruiners Posted February 28, 2007 Author Share Posted February 28, 2007 doc_title contains just the names of different documents. The original code is: $tech = " select d.doc_id, d.doctype_id, d.doc_summary, d.doc_title, p.dpdf_name, doc.doctype_title, doc.doctype_img, doc.doctype_img_alt, d.doc_textversion from doctype doc,document d left join pdf p on d.dpdf_id = p.dpdf_id where d.doc_id='".base64_decode($_GET['id'])."' and d.doctype_id=doc.doctype_id"; But i want it to display the documents in alphabetical order, so i added the order by like this: $tech = " select d.doc_id, d.doctype_id, d.doc_summary, d.doc_title, p.dpdf_name, doc.doctype_title, doc.doctype_img, doc.doctype_img_alt, d.doc_textversion from doctype doc,document d left join pdf p on d.dpdf_id = p.dpdf_id where d.doc_id='".base64_decode($_GET['id'])."' and d.doctype_id=doc.doctype_id order by d.doc_title asc"; So i added the "order by d.doc_title asc" coz i want it in alphabetical order. Thanks again for your assistance, still new to all this Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196149 Share on other sites More sharing options...
fenway Posted February 28, 2007 Share Posted February 28, 2007 And that ordering isn't what you want? I'm confused? Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196192 Share on other sites More sharing options...
craigbruiners Posted February 28, 2007 Author Share Posted February 28, 2007 Yes i do want that order but the code doesnt order it in a alphabetical way. Coz if i put in that "order by" code it doesnt do anything, so how do i get it to display the documents in a alphabetical way Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196199 Share on other sites More sharing options...
fenway Posted February 28, 2007 Share Posted February 28, 2007 I have a hard time believing that... if you change it to DESC from ASC, your result set doesn't come out the other way? Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196208 Share on other sites More sharing options...
craigbruiners Posted February 28, 2007 Author Share Posted February 28, 2007 No matter if i put it as ASC or DESC nothing happens, it just displays it the way it wants to from the database, is there anything else i could maybe do maybe coz i get this feeling that im confusing myself now :D ;D Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196214 Share on other sites More sharing options...
fenway Posted February 28, 2007 Share Posted February 28, 2007 That's not really possible... I don't know what else to tell you. Are you sure you're actually running this query where you think you are? Post the entire code snippet from the connection to the output. Quote Link to comment https://forums.phpfreaks.com/topic/40507-need-help-with-getting-the-information-to-display-in-alphabetical-order/#findComment-196220 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.