Fatal error: Call to undefined function INET_ATON()

橙三吉。 提交于 2019-12-11 22:45:19

问题


I'm successfully storing an IP address in my database using the the INET_NTOA function as follows:

$sql="INSERT INTO $tbl_subnets(address) VALUES(INET_NTOA('$address')

However when trying to reverse this when selecting the address using INET_ATON I get the the following error:

Fatal error: Call to undefined function INET_ATON()

Using this code...

<?php
    $sql="SELECT * FROM subnets";
        $result=mysql_query($sql);

        // Start looping the rows in the database.
        while($rows=mysql_fetch_array($result)){
?>

<td><?php echo $rows[INET_ATON('address')]; ?></td>

<?php

}

?>

Anyone can shed some light on this for me? Thanks


回答1:


inet_aton() is a Mysql function. In PHP, you'd use inet_ntop() and inet_pton().



来源:https://stackoverflow.com/questions/8670221/fatal-error-call-to-undefined-function-inet-aton

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!