kalster Posted November 19, 2012 Share Posted November 19, 2012 it seems that i can't get the $row variables once it is in a while loop. I have many ip fields in the table ip. i am trying to see if any of those field match the current ip. if it does then send the message. $result = mysql_query("SELECT * FROM _ipaddress") or die(mysql_error()); $ip = mysql_fetch_array( $result ); $getip = getipAddress(); while($row = mysql_fetch_assoc($result)){ if ($getip == $row){ echo "you can't register with the ip of " . $getip ; } } Link to comment https://forums.phpfreaks.com/topic/270897-why-is-this-code-not-working/ Share on other sites More sharing options...
Zane Posted November 19, 2012 Share Posted November 19, 2012 You're better off doing this through the SQL query SELECT * FROM ips WHERE ip = '$getip' Link to comment https://forums.phpfreaks.com/topic/270897-why-is-this-code-not-working/#findComment-1393501 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.