I have a table in my database called user_data. I want to select all rows of data from this table, where the user's advert_status is 'Active'.
However, there is also a column called advert_type in this table. The enum values of this are:
Deluxe, Premium and Basic.
I want to execute a MYSQLI query and list all users in the table where their advert_status is active. But i want to list deluxe users, then premium users and basic users - in that order.
Desired Result:
Deluxe User 1
Deluxe User 2
Deluxe User 3
Premium User 1
Premium User 2
Basic User 1
Basic User 2
Here's what i've tried.
$variable = $_GET['r'];
if($variable == '0') {
$query = $conn->query("SELECT * FROM user_data WHERE advert_status = 'Active' ORDER BY advert_type");
This doesn't do the job. Please can someone show me how to achieve my desired result? Thanks in advance.