I have created a MYSQL database and connected to it using Dreamweaver CS3.
There is a Master and Detail page and the initial creation works correctly. (not bad for my first attempt!!):cool:
The site is for a dog rescue charity and it would be best to be able to insert new dogs in alphabetical order.
However, I am having great trouble in adding/inserting to the database new items in alphabetical order using Dreamweaver CS3!

I think that I have got myself in a loop and have almost lost the ability to think straight.:'(

Many thanks in advance


PS I hope that this is the right forum

7 Years
Discussion Span
Last Post by brandonrunyon

You simply do NOT insert anything in alphabetical order (or any other order for that matter). The order the data is stored in a database is totally and utterly irrelevant. What matters is what you do when you retrieve the data, and what data you retrieve of course.

To get the data in some order, you add an order by clause to the end of your sql query.

eg instead of
SELECT id, name, breed, gender, dateRescued
FROM animals
WHERE type ="dog";

you would use
SELECT id, name, breed, gender, dateRescued
FROM animals
WHERE type ="dog"
ORDER BY name;

I think you may have to read up a bit of databases if you think the order the data is stored matters ;)

Edited by drjohn: n/a

Votes + Comments
comprehensive and clear explanation

drjohn is right erin. You should accept database entries as they are without additional sorting, it would be inefficient and (as you probably have already come to find) ridiculous to do otherwise. The database is unconcerned with the names or types of entities you store in them. Selecting by the ORDER BY name SQL will sort the unordered names by alphabetical/numerical order first to last. drjohn has in as far as I can tell solved your question.


Hi Everyone,

Many thanks for your answers. At this moment I am unable to look at the project as I am busy working for a client. I hope to have time tomorrow.
In the meantime, if I amend the query as suggested, when I add an item (a dog) it will be seen on the website in the right alphabetical order?
I understand that the database doesn't care, it is when people look at the site I don't want (for example) a new dog with the name of Amber showing a the end of the page.
I hope this makes sense and I appreciate everyone's comments.


When I add the line to the query I get the following message:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY name LIMIT 0, 9' at line 1


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.