ivytony Posted March 19, 2008 Share Posted March 19, 2008 I want to store IP address in the format of 32-bit unsigned integer instead of the readable IP address (e.g. 127.0.0.1). So I use this sql statement: mysql> INSERT INTO tbl VALUES (..., INET_ATON('127.0.0.1'), ...) however, before I insert this IP value, I need to serialize it by using the equivalent php function to convert readable IP address gethostbyaddr($ip_address); When I put this above expression in serialize(), it gives me a NULL. I am wondering how to serialize a 32-bit integer. This code is used for a voting system that record voter's IP address (same IP address cannot vote twice), which is the reason for using serialize(). anyone knows? thanks Link to comment https://forums.phpfreaks.com/topic/96835-how-to-serialize-a-32-bit-unsigned-integer/ Share on other sites More sharing options...
kenrbnsn Posted March 19, 2008 Share Posted March 19, 2008 That's not what the serialize function is used for. It is used to convert an array into a string. Please try to explain your problem better. Ken Link to comment https://forums.phpfreaks.com/topic/96835-how-to-serialize-a-32-bit-unsigned-integer/#findComment-495559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.