利用mysql自带内置函数: INET_ATON(expr)Given the dotted-quad representation of a network address as a string, returns an
利用mysql自带内置函数:
INET_ATON(expr)
Given the dotted-quad representation of a network address as a string, returns an integer that represents the numeric value of the address. Addresses may be 4- or 8-byte addresses.
mysql> SELECT INET_ATON('209.207.224.40');
-> 3520061480
The generated number is always in network byte order. For the example just shown, the number is calculated as 209×2563 + 207×2562 + 224×256 + 40.
INET_ATON() also understands short-formIPaddresses:
mysql> SELECT INET_ATON('127.0.0.1'), INET_ATON('127.1');
-> 2130706433, 2130706433
Note: When storing values generated by INET_ATON(), it is recommended that you use an INT UNSIGNED column. If you use a (signed) INT column, values corresponding toIPaddresses for which the first octet is greater than 127 cannot be stored correctly. See Section 11.2, “Numeric Types”.
INET_NTOA(expr)
Given a numeric network address (4 or 8 byte), returns the dotted-quad representation of the address as a string.
mysql> SELECT INET_NTOA(3520061480);
-> '209.207.224.40'
以上是Mysql手册中的说明,实际使用方法:
我的ip是以字符串形式存储在表table_ip的ip_info字段中,可以用下面的查询语句返回以ip排序的结果
select ip_info from table_ip order by inet_aton(ip_info);
结果:
192.168.6.10
192.168.6.60
92.168.6.120
92.168.6.240
...
实时捕捉 一旦访问者打开您的网站,系统会立即显示,这时您就可以查看用户的信息,如:来自搜索引擎关键词、友情链接或直接访问;访问者的IP地址,所在地区,正在访问哪个网页;以及访问者使用的操作系统、浏览器、显示器屏幕分辨率颜色深度等。 主动出击 变被动为主动,可以主动邀请访问者进行洽谈勾通,帮助客户深入了解您的企业和产品,同时获得对方的采购意向、联系方式等信息。 互动交流 主动销售和在线客服合二为一,
0
推荐阅读:
数据量增加导致MySQL执行计划改变
MySQL数据库安全模式登陆

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号