Re: array fill/sort question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,

you can add the ip2long() function into your SELECT statement and have
an ORDER BY clause at the end like this...

SELECT s_id, subnet_name, ip2long('subnetaddr'), subnetmask,dnsdomain,
location, contact, ccn FROM subnets ORDER BY subnetaddrr;

hope it helps.
KD


On Tue, 10 Jun 2003, Snijders, Mark wrote:

> hi,
>
> I'm working on a ipaddres/subnet programm
>
> now i have a talbe with a lot of information about ip-addresses
>
> i'm having this query:
>
> SELECT s_id, subnet_name,subnetaddr,subnetmask,dnsdomain, location, contact,
> ccn FROM subnets
>
> the subnetaddr field looks like this : 100.20.20.1  and is ofcourse a
> varchar field
>
> BUT before displaying it on the screen i have to sort it by subnetaddr and
> then show it
>
> but i have to sort it as integer, so i use the php-function ip2long();
>
> so you get a decimal...
>
> so what i have to do:
>
> do the query> make a decimal field of the 'subnetaddr' put it in an array,
> sort it and display it
>
>
> BUT how can i put ALL of the fields in the query in an array, sort it, and
> then display it?
>
> please help me, I can't work it out :(
>
> thanks, Mark
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux