close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Order History Sort

Thread began 6/21/2011 6:50 am by gzirfas374932 | Last modified 6/21/2011 1:18 pm by gzirfas374932 | 949 views | 2 replies |

gzirfas374932

Order History Sort

My order history is putting the orders in what appears (I'm sure it's not) to be a random order (#61, 62, 51). I would like to sort the order history descending so the most recent order is always first (ORDER BY OrderID DESC). With everything that's going on I'm not sure how to accomplish this.

currently i have this in my record set query...

SELECT OrderID, OrderShipName, OrderAmount, OrderCountry, OrderShipping, OrderEmail, OrderDate, OrderShipped, OrderTrackingNumber
FROM orders
WHERE OrderUserID = WADAUser_ID

I have 2 variables: WADAUser, type N/A, default value -1 $_SESSION['User_ID']
and WADAUser_ID, type interter, default value -1 and no runtime value.

Can you help?

Sign in to reply to this post

Jason ByrnesWebAssist

add the order by clause after the where clause:

SELECT OrderID, OrderShipName, OrderAmount, OrderCountry, OrderShipping, OrderEmail, OrderDate, OrderShipped, OrderTrackingNumber
FROM orders
WHERE OrderUserID = WADAUser_ID
ORDER BY OrderID DESC

Sign in to reply to this post

gzirfas374932

Thanks, little hickup that had to be fixed

Well, that's exactly what I thought, but when I tried to do it in DW record set query it kept giving me errors with the variables. I found the code on the page and added it there and all works great. You are the best!

mysql_select_db($database_users, $users);
$query_WADAorders = sprintf("SELECT OrderID, OrderShipName, OrderAmount, OrderCountry, OrderShipping, OrderEmail, OrderDate, OrderShipped, OrderTrackingNumber FROM orders WHERE OrderUserID = %s ORDER BY OrderID DESC", GetSQLValueString($WADAUser_ID_WADAorders, "int"));
$query_limit_WADAorders = sprintf("%s LIMIT %d, %d", $query_WADAorders, $startRow_WADAorders, $maxRows_WADAorders);
$WADAorders = mysql_query($query_limit_WADAorders, $users) or die(mysql_error());
$row_WADAorders = mysql_fetch_assoc($WADAorders);

Sign in to reply to this post

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