473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Ordering models in a list then saving to db

Hi guys,

I am trying to allow the models in a mysql database to be ordered by the
site owner.

I was thinking along the lines of a <SELECT> list containing the model names
and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list
however.

Any suggestions?

Thanks for your time,

Matt
Jul 17 '05 #1
8 1680
In article <c7*********@hercules.btinternet.com>, Matt Fletcher wrote:
Hi guys,

I am trying to allow the models in a mysql database to be ordered by the
site owner.
So you should lookup the "ORDER BY" part in a SQL query.
I was thinking along the lines of a <SELECT> list containing the model names
and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list
however.


You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.
--
http://home.mysth.be/~timvw
Jul 17 '05 #2
Yeah I was thinking the same but how can i get the order from the list
Thanks
"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:2g************@uni-berlin.de...
In article <c7*********@hercules.btinternet.com>, Matt Fletcher wrote:
Hi guys,

I am trying to allow the models in a mysql database to be ordered by the
site owner.


So you should lookup the "ORDER BY" part in a SQL query.
I was thinking along the lines of a <SELECT> list containing the model names and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list however.


You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.
--
http://home.mysth.be/~timvw

Jul 17 '05 #3
Yeah I was thinking the same but how can i get the order from the list
Thanks

"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:2g************@uni-berlin.de...
In article <c7*********@hercules.btinternet.com>, Matt Fletcher wrote:
Hi guys,

I am trying to allow the models in a mysql database to be ordered by the
site owner.


So you should lookup the "ORDER BY" part in a SQL query.
I was thinking along the lines of a <SELECT> list containing the model names and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list however.


You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.
--
http://home.mysth.be/~timvw

Jul 17 '05 #4
Yeah I was thinking the same but how can i get the order from the list
Thanks
"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:2g************@uni-berlin.de...
In article <c7*********@hercules.btinternet.com>, Matt Fletcher wrote:
Hi guys,

I am trying to allow the models in a mysql database to be ordered by the
site owner.


So you should lookup the "ORDER BY" part in a SQL query.
I was thinking along the lines of a <SELECT> list containing the model names and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list however.


You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.
--
http://home.mysth.be/~timvw

Jul 17 '05 #5
In article <2g************@uni-berlin.de>, Tim Van Wassenhove wrote:
In article <c7*********@hercules.btinternet.com>, Matt Fletcher wrote:
Hi guys,

I am trying to allow the models in a mysql database to be ordered by the
site owner.


So you should lookup the "ORDER BY" part in a SQL query.
I was thinking along the lines of a <SELECT> list containing the model names
and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list
however.


You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.

^^^^^

Actually, I doubt very seriously you could do that since 'order' is reserved
word in mySQL and you would not be allowed to create a table with that column
name...

Kevin
Jul 17 '05 #6
Kevin Collins wrote:
In article <2g************@uni-berlin.de>, Tim Van Wassenhove wrote:
You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.

Actually, I doubt very seriously you could do that since 'order' is reserved
word in mySQL and you would not be allowed to create a table with that column
name...


SCNR
mysql> CREATE TABLE impossible (
-> id int primary key auto_increment,
-> `order` int
-> );
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO impossible values(NULL, 5), (NULL, 4), (NULL, 8), (NULL, 1);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> SELECT * FROM impossible ORDER BY `order`;
+----+-------+
| id | order |
+----+-------+
| 4 | 1 |
| 2 | 4 |
| 1 | 5 |
| 3 | 8 |
+----+-------+
4 rows in set (0.01 sec)

mysql>

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #7
In article <sl************************@doom.unix-guy.com>, Kevin Collins wrote:
In article <2g************@uni-berlin.de>, Tim Van Wassenhove wrote:
In article <c7*********@hercules.btinternet.com>, Matt Fletcher wrote:
Hi guys,

I am trying to allow the models in a mysql database to be ordered by the
site owner.


So you should lookup the "ORDER BY" part in a SQL query.
I was thinking along the lines of a <SELECT> list containing the model names
and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list
however.


You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.

^^^^^

Actually, I doubt very seriously you could do that since 'order' is reserved
word in mySQL and you would not be allowed to create a table with that column
name...


I hope it's obvious that i meant to write ORDER BY ordernumber. What
else would have the ordernumber been good for?

And as Pedro already mentionned,
http://dev.mysql.com/doc/mysql/en/Legal_names.html
--
http://home.mysth.be/~timvw
Jul 17 '05 #8
Yes well in truth that wasn't my problem. I wanted to get the list box items
and save the order to the database.
I have now figured out that you have to use javascript to select all the
list items, add them to a hidden form field. Then use the hidden field
variable in PHP and split it up into an array of model names.
Now I'll update the order column in the database against the array one by
one.

Thanks for your responses,
MAtt

"Kevin Collins" <sp*********@toomuchfiction.com> wrote in message
news:sl************************@doom.unix-guy.com...
In article <2g************@uni-berlin.de>, Tim Van Wassenhove wrote:
In article <c7*********@hercules.btinternet.com>, Matt Fletcher wrote:
Hi guys,

I am trying to allow the models in a mysql database to be ordered by the site owner.
So you should lookup the "ORDER BY" part in a SQL query.
I was thinking along the lines of a <SELECT> list containing the model names and Up and Down buttons to move the models up and down the list.

I am unable to come up with a solution for getting the order from the list however.


You could add a column to your model table that contains the
ordernumber. And then use ORDER BY order in your query.

^^^^^

Actually, I doubt very seriously you could do that since 'order' is

reserved word in mySQL and you would not be allowed to create a table with that column name...

Kevin

Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ken Fine | last post by:
(originally posted to one of macromedia's groups; no help, so hopefully someone here can help me out. I'm using VBScript ASP.) When designing administrative interfaces to websites, we often need...
15
by: Kay Schluehr | last post by:
Here might be an interesting puzzle for people who like sorting algorithms ( and no I'm not a student anymore and the problem is not a students 'homework' but a particular question associated with...
2
by: Ken Durden | last post by:
Is there any way to control ordering of items in intellisense via attributes? For example, I have the following enum: public enum ESeverity { Acceptable, Low, Medium,
3
by: marc | last post by:
I want to create a strongly typed collection and use DictionaryBase I add a number of objects but when i loop through the list the data is ordered in a strange maner. How is this possible? Can...
1
by: Matt Roberts | last post by:
Please accept my apologies if this is answered elsewhere in the archives or docs but I have searched without luck. I've always assumed that default ordering of selects are based on a first in...
20
by: Brian Tkatch | last post by:
An ORDER BY a simple-integer inside a FUNCTION, results in SQL0440N, unless the FUNCTION expects an INTEGER as its parameter. For example: DECLARE GLOBAL TEMPORARY TABLE A(A CHAR(1)) INSERT INTO...
21
by: John Salerno | last post by:
If I want to make a list of four items, e.g. L = , and then figure out if a certain element precedes another element, what would be the best way to do that? Looking at the built-in list...
23
by: illegal.prime | last post by:
Hi all, is there a key value collection in .Net that maintains the ordering in which I add items. I'm finding that I'm creating a number of classes that contain a name and then some object. I...
5
by: =?Utf-8?B?VG9t?= | last post by:
Cannot not seem to make any sense of the order that my key/values end up in when added to the Hashtable...ideally, I would like to be able to sort the keys/values...but not thinking it is possible....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.