Reply to Re: PHP <> MySQL on Win2k Advanced server not returning r

Your name:

Reply:


Posted by Hilarion on 08/29/05 17:43

Ace <admin@fsworld-dot-us.no-spam.invalid> wrote:
> I have just installed ip2country - This is a database consisting of
> 56000 records of IP address ranges. Typically the application checks
> a users IP address - converts it to long format then queries the
> database with the following query
>
> SELECT IP_FROM, IP_TO, COUNTRY_CODE2, COUNTRY_CODE3, COUNTRY_NAME FROM
> ip2country WHERE IP_FROM <= 2113928215 and IP_TO >=2113928215
> LIMIT 0, 1;
>
> The database then returns the country name , and country code of the
> IP address.
>
> The query works, however if the record is past row 2709 - MySQL DOES
> NOT return the result! I.E it is only reading the first 2708 rows.
> Any result stored after that row is simply returning nothing.


Make sure the IP you are asking for is there (manualy). Maybe there
are problems with going out of range of PHP intergers (check how
does the query, which does not return values, look like before
sending them to MySQL). Remember that IP converted to PHP integer
may result in negative values, so sprintf with "%u" format should
be used to put such value into the query string (check "ip2long"
function description in PHP manual).

You may also simplify your query by using BETWEEN:
SELECT ip_from, ip_to, country_code2, country_code3, country_name
FROM ip2country
WHERE 2113928215 BETWEEN ip_from AND ip_to
LIMIT 0, 1;



Hilarion

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация