Using the database with php?

Development discussion about the hostip.info codebase, libraries, and database

Moderator: Moderators

Using the database with php?

Postby gf-jonas on Mon May 28, 2007 1:35 am

Hello.

I have downloaded the database data and imported it to a MySQL database. I have downloaded the code from the svn and have looked at the php brach.
It seams like the code in the svn is much older than the database as it uses a diffrent approch to getting the ip from the database.

I thought I could work around this, but I think I don't understand the database format (the conversion I need to do).
I thought I should take a.b.c.0 and make it to a long (using ip2long as suggested in ahother thread), but I get no hits on any ip's (I am using the api as well while I test and from there all the ips are known) (with no hits I mean that if (@mysql_num_rows($result) == 0) validates as true)

my php code for making the database selection looks like
$ipRange = $a . "." . $b . "." . $c . ".0";
$longIp = sprintf("%u", ip2long($ipRange));
$sql = "SELECT * FROM ip4 WHERE ip=" . $longIp;


Any suggestions on what I am doing wrong and how I should make my selection instead?

edit: I Have tested with the ip 231.140.6.0 and using this becomes 3884713472 (as stated in viewtopic.php?t=194 ).
gf-jonas
n00b
 
Posts: 1
Joined: Mon May 28, 2007 1:27 am

Return to Hostip.info code/database devel

Who is online

Users browsing this forum: No registered users and 2 guests