Jump to content

how to serialize a 32-bit unsigned integer


ivytony

Recommended Posts

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

 

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.