2011-12-29 186 views
0

我使用的INET_NTOA功能如下成功存儲的IP地址在我的數據庫:嘗試使用選擇地址時要扭轉這種時候致命錯誤:調用未定義功能INET_ATON()

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

然而INET_ATON我得到了以下錯誤:

致命錯誤:調用未定義功能INET_ATON()

使用此代碼...

<?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 

} 

?> 

任何人都可以爲我揭示一些事情嗎?謝謝

+0

這不是一個PHP函數。你不能在PHP中調用它 – 2011-12-29 16:14:29

+0

PHP和SQL之間經常被忽視的區別... – 2011-12-29 16:15:39

+0

在PHP中可能的[INET_ATON()和INET_NTOA()重複?](http://stackoverflow.com/questions/2754340/inet- aton-and-inet-ntoa-in-php) – 2011-12-29 16:15:54

回答

2

inet_aton()是一個Mysql函數。在PHP中,您將使用inet_ntop()inet_pton()

+1

我現在在使用PHP函數,但我現在得到一個錯誤:Warning:inet_ntop()[function.inet-ntop]:無效的in_addr值 – Bernard 2011-12-29 17:04:27

相關問題