Whats wrong with this code?

From: Date: Tue, 17 Jul 2001 02:44:57 +0000
Subject: Whats wrong with this code?
Groups: php.general 
Request: Send a blank email to php-general+get-58162@lists.php.net to get a copy of this message
Hi all, Im getting mighty frustrated with this peice of code. It checks the first condition no probs, but the second IF statement doesnt work. So it will stop if it finds a du[plicate login, but cannot find duplicate passwords. the $num_rows2 variable always gets the value '0' even when there is an existing password the same as the new user-entered value. I hope its a really simple syntax problem that i cant see. The slight syntaxic (is that a word?) differences between the 2 IF statements are due to 'trying anything' to get it working.... I hope someone out there can help. Thanks in advance, Brad // ************* Check for existing duplicate login $result = mysql_query("SELECT * FROM Login_TB where Login='$Login'",$db) or die ("ouch"); $num_rows = mysql_num_rows($result); // echo $num_rows; if ($num_rows != 0) { session_register("errorMsg"); $errorMsg = "Username taken."; echo $errorMsg; exit; } // ************* Check for existing duplicate password $query2 = "select * FROM Team_Login_TB where Pass = password('$Pass')"; $result2 = mysql_query($query2,$db) or die ("ouch2"); $num_rows2 = mysql_num_rows($result2); echo $num_rows2; if ($num_rows2 != 0) { session_register("errorMsg"); $errorMsg = "Password taken."; echo $errorMsg; exit; }

« previous php.general (#58162) next »