web_master Posted April 2, 2010 Share Posted April 2, 2010 Hello, I got an script where in database is stored the IP of the users, but it is in "VARBINARY" How can I reload it from database, because when I reload it "simple" I can't see anything only chars like this: R��(... THanx in advanced Link to comment https://forums.phpfreaks.com/topic/197398-how-to-read-varbynary-with-php/ Share on other sites More sharing options...
monkeytooth Posted April 2, 2010 Share Posted April 2, 2010 Make sure the columns char set is utf-8-general-ci Link to comment https://forums.phpfreaks.com/topic/197398-how-to-read-varbynary-with-php/#findComment-1036077 Share on other sites More sharing options...
web_master Posted April 2, 2010 Author Share Posted April 2, 2010 Make sure the columns char set is utf-8-general-ci There is not set collation for column ip, and I can't change it Link to comment https://forums.phpfreaks.com/topic/197398-how-to-read-varbynary-with-php/#findComment-1036080 Share on other sites More sharing options...
teamatomic Posted April 2, 2010 Share Posted April 2, 2010 Then maybe unpack() will work. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/197398-how-to-read-varbynary-with-php/#findComment-1036100 Share on other sites More sharing options...
web_master Posted April 2, 2010 Author Share Posted April 2, 2010 I find the solution: <?php $ip = $reload['ip']; $packedip = unpack('Nlong', $ip); echo long2ip($packedip['long']); ?> thnk You for suggestions! Link to comment https://forums.phpfreaks.com/topic/197398-how-to-read-varbynary-with-php/#findComment-1036160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.