0

This is stumping me...it's probably pretty obvious, but I'm working under medication for the flu...
I finally got my form submitting to my database and to separate tables from the update.php script. Problem is, (I know this sounds trivial and I shake my head as I query) I can't get the display page to update in order.
Let me illucidate...I created a form that updates a database split into 3 separate tables. I also created a page with a dynamic table that displays certain aspects from the database for public viewing. Everything works fine...the form appends the database and the dynamic table on the display page displays the pertinent info from the database. The problem is that the dynamic table displays the database info in the wrong order. I want the table to display the form info in the order that its added.
ie. someone fills out the form->their info is added to the dynamic table->someone else fills out the form->their info is displayed below the last entry->and so on.
My dynamic table currently displays each new entry above the last.
Is it something I need to adjust in my database? or is there some way to adjust the display order in the dynamic table?

4
Contributors
5
Replies
7
Views
6 Years
Discussion Span
Last Post by HedoBum
0

when you display the tables, your mysql query should be

SELECT * FROM table ORDER BY id ASC or DESC // pick either ASC or DESC.

I think that is what you were talking about. If not, please post code so we can analyze it.

0

TY fobos...should have gotten that. I actually looked at the "SELECT" code line a couple times and it didn't even register. Let this be a lesson to you kids...don't take meds and do coding...they do not mix.

0

Terminology you are using, ie. '..appends the database and the dynamic table on...' is kind of confusing to me. But here are few ideas:

- ordering of your results should generally occur in database layer. So try your query before doing anything on HTML! Use ORDER BY ascending/descending (google ORDER BY)
- if insertion/retrieval is messy and confusing then there is nothing wrong with assigning a order number to the record itself. I am not sure if this applicable to the problem you're trying to solve, but sometimes it makes more sense, its easier to maintain (and is more intuitive) to just assign an order to entries. Ie., if you are dynamically building a form with 20 text fields where their order matters!

0

Thanks for the input timhysniu, but as you may have noticed, this thread is marked as solved. You merely reiterated what fobos posted.
For the sake of anyone using this thread to solve a problem of their own that closely resembles this...
The point was to get the dynamic table of my display page to display certain database info in the same order that the data is entered from the form (the data is displayed in the order that people submit their form info). Sorry, I thought I was clear on this point.
Regardless, the problem is indeed solved with the info that fobos posted. For those using Dreamweaver (I'm using CS5) and you are using RecordSets, it actually gives you the option to set the order of the RecordSets when you create them...had I been paying attention to what I was doing when I created my RecordSets, I wouldn't have had this problem in the first place.

This question has already been answered. 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.