473,372 Members | 1,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

problems sorting an array

hello ng!

got a problem sorting my multi-dimensional array. I have the following
situation of an array:

$fahrzeugarray[0]["fzid"]= "23"
$fahrzeugarray[0]["fzname"]="Audi TT"
$fahrzeugarray[1]["fzid"]= "34"
$fahrzeugarray[1]["fzname"]="VW Polo 1.2"
$fahrzeugarray[2]["fzid"]= "57"
$fahrzeugarray[2]["fzname"]="BMW Z3"

now i need to sort the array by 'fzname' before showing it. got to create
<SELECT> list with the 'fzid' as value and 'fzname' as text.
I use the following code to handle that but it doesn't work:

---------------------------------------------------------------------------------------
array_multisort($fahrzeugarray["fzname"]);
foreach($fahrzeugarray as $show_fza)
{
echo "<option
value='".$show_fza["fzid"]."'>".$show_fza["fzname"]."</option>";
}
---------------------------------------------------------------------------------------

when i start the script it shows the list without sorting it before. that's
a problem i try to solve sonce hours.
perhaps some one got an idea what is wrong with my script? :)

many thanks!

Jochen
Jul 17 '05 #1
1 1431
Jochen Califice <ma**@boomboxx.de> wrote:
now i need to sort the array by 'fzname' before showing it. got to create
<SELECT> list with the 'fzid' as value and 'fzname' as text.
I use the following code to handle that but it doesn't work:

array_multisort($fahrzeugarray["fzname"]);

when i start the script it shows the list without sorting it before. that's
a problem i try to solve sonce hours.
perhaps some one got an idea what is wrong with my script? :)


You read the manual page of array_multisort? It doesn't do what you
want, see http://php.net/usort example 2.

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Kirby | last post by:
Hello All I am trying to update me code to use arrays to store a group of information and I have come up with a problem sorting the multiple array :( Array trying to sort: (7 arrays put into...
1
by: LRW | last post by:
I have a page that's doing a search of a database, create an array and displays it. And I have it displaying the array just fine, but when I try to sort it, I get the error: Warning: sort()...
7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
3
by: SilverWolf | last post by:
I need some help with sorting and shuffling array of strings. I can't seem to get qsort working, and I don't even know how to start to shuffle the array. Here is what I have for now: #include...
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
1
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
5
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.