Jump to content

Variable Displaying Over And Over


bob2588

Recommended Posts

        <?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.