Answer the question
In order to leave comments, you need to log in
Sorting by field in MySQL?
Hello.
Not strong in Mysql
I want to sort the product when displaying by a specific field. It was like this:
"SELECT * FROM `orders` WHERE `user_id`='".$_SESSION["user"]["id"]."'"
"SELECT * FROM `orders` WHERE `user_id`='".$_SESSION["user"]["id"]."' IN (status) ORDER BY FIELD(status,'Активен')"
Answer the question
In order to leave comments, you need to log in
"SELECT * FROM `orders` WHERE `user_id`='" . $_SESSION["user"]["id"] . "' AND `status` = 'Активен'"
Do you need sorting or filtering?
SELECT * FROM `orders` WHERE `user_id`='" . $_SESSION["user"]["id"] . "' and 'status' = 'Активен'
is a filter. It will show all the lines in which status = Active and user_id = $_SESSION["user"]["id"] Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question