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 Link to comment https://forums.phpfreaks.com/topic/218593-variable-displaying-over-and-over/ 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. Link to comment https://forums.phpfreaks.com/topic/218593-variable-displaying-over-and-over/#findComment-1133878 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.