Database query results can not be used directly, such as MySQL, such as the results in the statement, so you need to sort the results in some way. Example 4. Sort database results Each cell in the data array in this example represents a row in a
function bool Array_multisort (array & $arr [, Mixed $arg = Sort_asc [, Mixed $arg = Sort_regular [, mixed $ ...]])
Parameter description: function to sort multiple arrays or multidimensional arrays
The first argument is an array, and each
Sorting 2-D arrays or multidimensional arrays is a common problem, in PHP we have a special multidimensional array sorting function, the following briefly:Array_multisort (array1,sorting order, sorting type,array2,array3. is a function that sorts
Function bool array_multisort (array & $ arr [, mixed $ arg = SORT_ASC [, mixed $ arg = SORT_REGULAR [, mixed $...])Parameter description: The function sorts multiple arrays or multi-dimensional arrays.The first parameter is an array, and each
Array_multisort sorts multiple arrays or multi-dimensional arrays. For more information, see.
Array_multisort sorts multiple arrays or multi-dimensional arrays. For more information, see.
Function bool array_multisort (array & $ arr [, mixed $
Database query results sometimes can not be used directly, such as MySQL with in statements out of the results, so need to sort the results in some way.
Example 4. To sort the results of a database
In this example, each cell in the data array
Two-dimensional array sorting, and subscript rearrangement
Title, I sort of a field, row, found subscript also follow, hope Subscript re-arrange, from 0~ start Platoon, ask how to do?
------Solution--------------------
PHP Code
$fruits = Array (
About ajax, an exception is reported, but null is inserted in mysql.
Homepage
Contact a Foreman
Odd Job Market
Bidding Platform
Personal Center
Script
Function
Two-dimensional array sorting, and the subscript re-arranged as the question, I sorted a field, after sorting, found that the subscript also followed, hope that the subscript again, from 0 ~ Start sorting. how can this problem be solved ?, PHPcode $
This article introduces the use of the Array_multisort function in PHP for two-dimensional array ordering examples, there is a need for friends, refer to the bar. Following an article: Php two-dimensional array sorting custom function, today, we
Sort PHP arrays in detail. PHP array sorting is actually sorting the PHP array. in this article, we also sort the result set queried by the database. Sometimes the database query results cannot be directly used. in PHP array sorting, the PHP array
When using PHP to parse XSL in php applications, the template technology is required for data and code separation. Pear, phplib and many companies have provided related templates. However, they share a common drawback: there is no uniform
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.