bob2588 Posted November 13, 2010 Share Posted November 13, 2010 <?php include'db.php'; $session= $_SESSION['username']; $query="SELECT * FROM login_ip WHERE login='$session'"; $result= mysql_query($query); $count= mysql_num_rows($result); //$close = die($query); $min= $count - 1; $find= mysql_query("SELECT * FROM login_ip WHERE login= '$session' & times='$min'")or die(mysql_error()); while($row = mysql_fetch_assoc($find)) { $lip=$row['ipaddress']; echo" <br>$min<br>$count"; } ?> i worte the code above to pull the last ip address that a user has login form it is finding the ip adress but it is displaying like this 72.145.25.457 72.145.25.457 72.145.25.457 72.145.25.457 72.145.25.457 so i remove the $lip form the echo and place $min and $count in there and i am getting 1 2 1 2 1 2 1 2 Can some one please enplane why i am getting this problem thank you Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted November 13, 2010 Share Posted November 13, 2010 Use the LIMIT clause in MySQL Link: http://php.about.com/od/mysqlcommands/g/Limit_sql.htm Regards, Paul. Quote Link to comment Share on other sites More sharing options...
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.