php - Sort an array by specific values -
Here's the scenario, I have a database and I need data to display in a data that is from four tables Is different. I was having difficulty in involving such questions that would give me the necessary results in the correct order and format, so I asked many questions and pushed the results into more array. So now I have this array and it does a great job till now.
I have the data listed in the table to see it and I need to sort the table based on the top.
What I need to do next is how some sort of array with a specific value.
For example, I have an array in which there is a value ??? ? I want to search the array for specific ??? And then sort the array based on that. So if a type of type contains items in the column such as '' file '', a link ??? Or "quoze" will be described in alphabetical order.
Is this possible? Or am I thinking about this in a different way?
Can anyone tell me in the right direction?
In most cases, you will probably have better results due to working in database rather than post processing in PHP .
As other people are saying, some more specific information and code examples will be allowed to provide better help, but depending on what you have said:
A specific type To limit your query results, you must add an outer section:
[whatever column] from TABLE_NAME where type = 'file' You want to select several types at the same time:
select [whatever call ] Where you want to type TABLE_NAME ('file', 'link', 'quiz') You order them to sort alphabetical types:
Select Where to type TABLE_NAME ('file', 'link', 'quiz') by order type ASC
Comments
Post a Comment