Re: array fill/sort question
| From: | Sean Burlington | Date: | Wed, 11 Jun 2003 13:02:40 +0000 |
| Subject: | Re: array fill/sort question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28535@lists.php.net to get a copy of this message | ||
Snijders, Mark wrote:
hi, no the both sollutions won't work cause: I can't sort within a query cause subnetaddr is a varchar ("10.10.10.10") so it will be ordere like this 10.10.10.10 100.10.10.10 60.10.10.10 and that's not good cause 60 is smaller as 100, so with the function ip2long() i will first make an integer of it the second array solution you gave, won't work, cause I need ALL the query results in the array, and that's the problem I can't handle.... if I would do it like you said, I can sort it, but then I have a sorted array and for each element I have to do a query again to get the other fields of the table, and that's not good (2500 rows) so can please still somebody help me with this?can you change the database format ? store the address as four ints - then you can concatenate them when you need to, and sort as you wish SELECT s_id, subnet_name, concat(subnetaddr1, '.', subnetaddr2, '.', subnetaddr3, '.', subnetaddr4) as subnetaddr ,subnetmask,dnsdomain, location, contact, ccn FROM subnets ORDER BY subnetaddr1, subnetaddr2, subnetaddr3, subnetaddr4; -- Sean