xida Posted August 20, 2009 Posted August 20, 2009 ok i was working on the referal for my site, and the first time it wouldnt add the information into the database, then when i got it to work it wouldnt add the ips properly, any idea why? first code $db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')"); new code $refer= sprintf("INSERT INTO referals VALUES ('', %u, %u, %u, %u, %u)", $_POST['ref'], $i, $time, $r['lastip'], $IP); $db->query($refer); the second code inputs the info into the database but for some reason when it inputs the info the ip is wrong e.g. users ip is 99.88.77.66 it saves it as only 99 not the rest any ideas? thanks :mrgreen: Quote
CrazyT Posted August 20, 2009 Posted August 20, 2009 Re: Need help with some referal coding $refer= sprintf("INSERT INTO referals VALUES ('', %u, %u, %u, '%s', '%s')", $_POST['ref'], $i, $time, $r['lastip'], $IP); $db->query($refer); There :) Quote
xida Posted August 20, 2009 Author Posted August 20, 2009 Re: Need help with some referal coding hahaha thanks alot, had a feeling it was something simple and silly i was forgeting :) thanks :-D Quote
CrazyT Posted August 20, 2009 Posted August 20, 2009 Re: Need help with some referal coding Although you can store IP's as INT instead of VARCHAR... http://dev.mysql.com/doc/refman/5.0/en/ ... tions.html Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.