Hello, Yesterday I wrote a script for a simple stumble exchange site. It allows the user to add their site to a list and then shows them a list of sites to stumble. The random sites are found using: while ($numofsite <= $num ) { $fcontents = join ('', file ('stumblesites.txt')); $s_con = split("~",$fcontents); $site_no = rand(0,(count($s_con)-1)); print "<a href=$s_con[$site_no]>$s_con[$site_no]</a>"; print "<br />"; $numofsite++; } I want to make it so users don't see their own sites. Both ones entered now and those entered previously. I tried to do this using: while ($numofsite <= $num ) { $fcontents = join ('', file ('stumblesites.txt')); $ucontents = join ('', file ('users.txt')); $s_con = split("~",$fcontents); $site_no = rand(0,(count($s_con)-1)); if("$user" != "$u_con[$site_no]") { print "<a href=$s_con[$site_no]>$s_con[$site_no]</a>"; print "<br />"; $numofsite++; } } Since the site and user who owns it are in the same line in the respective files this seemed like a good idea. However the code never sees $user and $u_con[$site_no] as being equal. $user is a text input from the form. Any help would be great. Thanks.
if("$user" != "$u_con[$site_no]") Remove the quotes. if($user != $u_con[$site_no]) Quotes are only used to delimit a text string. These are variables.