SQL Help needed

aloutos

BANNED
Joined
Feb 23, 2016
Messages
255
Reaction score
38
so i have a database in my website with some categories
for example

"instagram likes"
"instagram followers"
"youtube views"
etc..

i want to rearrange them and put the "youtube views" on top but the problem is that in each index of the array there is a value that is connected to my api system and cant be changed it will mess up the orders

so my thought was to put an extra field as identifier and sort the arrays with that identefier..so i can have the desired result

no idea how to do this..anyone can help t
ty
 
What if you sort the rows by category alphabetically?

select * from Category
order by Category DESC
 
Basically what legion85 is telling you is correct.
Go to phpmyadmin on Plesk.
Select the database that you want to work on
Then select the table that you want to work on, and then click on the SQL tab.
In that box there you enter the command that legion gave you, ie:

select * from youtube views
order by youtube views DESC
 
so i did what you said..but still no luck

i ended up creating a new field in the database "sort_id" and sorted them in descending ordder in the sql but the visual part still does not work

how can i sort them in the webpage?

Code:
@if( ! $services->isEmpty() )
                                    @foreach( $services as $service)
                                        <option value="{{ $service->id }}"> {{ $service->name  }}</option>
                                    @endforeach
                                @endif

this is the code i have in my php to show the services list , how can i sort those according to my new sort_id
 
Back
Top