The ORDER BY statement in sql is used to sort the fetched data in either ascending or descending according to one or more columns.
- By default ORDER BY sorts the data in ascending order.
- We can use the keyword DESC to sort the data in descending order and the keyword ASC to sort in ascending order.
“select * from $dealtable where user_id=’$uid’ AND status=’$status’ ORDER BY ID DESC”
“select * from $dealtable where user_id=’$uid’ AND status=’$status’ ORDER BY ID ASC”
Read More Posts
- How to create options is select html tag(drpopdown) in php?
- How to enqueue script and css file in child-theme and main plugin file in worpress?
- How to get current user info from wp user database in wordpress?
- How to fetch data from database in cordova app with ajax in wordpress?
- How to Make Billing and Shipping Fields Optional and required in WooCommerce?