close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Changing order of rows in a database

Thread began 8/08/2009 4:23 am by Carl | Last modified 1/30/2010 12:49 am by Carl | 3574 views | 14 replies

troyd

Brian,

Ok, I'm ashamed to admit this, since your tutorial is so well laid out, but I'm lost.

I got as far as #7, in the list of instructions. And I went even further by getting my list to be sortable. But I am getting an error when trying to post the results.

Where I'm lost is the use of the ID around #5 after we used "Order_Weight" and are echoing $oweight.

I do have the hidden field adding 1 to the "Order_Weight". That part works fine.

I've wrapped my results table in a form with the action pointing to a new page that includes the code edited (I think) for my application. Here is it just in case I missed something.

php:
<?php


if (isset($_POST["MM_update"])) {

            
$ordernumber 1;

            
$neworder $_POST['idorder'];

            foreach (
$neworder as $item){

                        
$updateSQL sprintf("UPDATE tblAvailable SET Order_Weight='$ordernumber' WHERE id='$item'");

                        
mysql_select_db($database_dbCMS$dbCMS);

                         
$Result mysql_query($updateSQL$dbCMS) or die(mysql_error());

                        ++
$ordernumber;

            } 

 
header('Location: tblavailable_Results.php');

 exit;

}

?>



In my case, the db is called dbCMS and the table is called tblAvailable.
I did create a column name "Order_Weight" and I included it in my insert.php pages Insert behavior.

Should I have an update behavior on my Results page for this?

The current errors are
"Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in..."
"Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in..."

Thanks again so much,
TroyD

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...