Jump to content

Need help with getting the information to display in Alphabetical order


craigbruiners

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

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.