* Wolfgang Gliese
> I want to sort my array (example: array[Ortslage, Strasse, Weg]) comming
> from a query.
A mysql query returns a 'resultset', not an 'array'. In PHP you can
transform the resultset to an array, and this array can be sorted using a
PHP function. However, this is a mysql list, and there is an (easier) mysql
solution... read on. :)
> Following script shows "Warning: sort() expects
> parameter 1 to
> be array, resource given in .../formular.php on line 36"
>
> var_dump($query) shows: "resource(6) of type (mysql result)"
I guess you mean var_dump($result), otherwise it would be strange...
> How should I do this?
>
> $query="select oart_bez from oart";
Try this:
$query="select oart_bez from oart ORDER BY oart_bez";
> $result=safe_query($query);
> $result=sort($result);
> while($wert=mysql_fetch_row( $result ))
> { print "<OPTION VALUE=\"" . $wert[0] . "\" selected>" . $wert[0];
> }
Read more about ORDER BY and other usefull options in the manual:
<URL: http://www.mysql.com/doc/en/SELECT.html >
--
Roger
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php