Jump to content

Need help with getting the information to display in Alphabetical order


Recommended Posts

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.  ;D

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.

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

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

;D

 

 

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

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 ;D ;D

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.

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.