Password compare, why isn't it working?
<p>I am using this to compare the password entered and the confirm password. No matter what, it creates the user. Why so?</p>

<p>here's the database code -</p>

<pre><code>$connect = @mysql_connect ($host, $username, $password) or die ('error');
$select = @mysql_select_db($db_name, $connect) or die('check');
$username=stripslashes(trim($_POST['username']));
$select_record="select * from users where username=' ".$username."' ";
$select_query=mysql_query($select_record)  or die (mysql_error());
if(mysql_num_rows($select_query)==0)

{
    $fullname = stripslashes(trim($_POST['fullname']));
    $email = stripslashes(trim($_POST['email']));
    $website = stripslashes(trim($_POST['website']));
    $username = stripslashes(trim($_POST['username']));
    $password = stripslashes(trim($_POST['password']));
    $add_new="insert into users (fullname,email,website,username,password) values ('$fullname','$email','$website','$username','$password')";
    $add_query=mysql_query($add_new) or die(mysql_error());
    if($add_query)
    {
        echo "Awesome! You are now a member";
    }
}
else
echo "Please try again";
?&gt;
</code></pre>

<p>Above connect, i have my database username and password.</p>

<p>Just to revise, here's my current code -</p>

<pre><code>&lt;div id="form"&gt;&lt;form action="registersuccess.php" method="post"&gt;
Full Name&lt;br /&gt;
&lt;input type="text" name="fullname"/&gt;
&lt;br /&gt;&lt;br /&gt;
Website&lt;br /&gt;
&lt;input type="text" name="site"/&gt;&lt;br /&gt;&lt;br /&gt;
Email&lt;br /&gt;
&lt;input type="text" name="email"/&gt;&lt;br /&gt;&lt;br /&gt;
Username&lt;br /&gt;
&lt;input type="text" maxlength="255" name="username"/&gt;&lt;br /&gt;
&lt;br /&gt;
Password&lt;br /&gt;
&lt;input type="password" name="password"/&gt;&lt;br /&gt;
&lt;br /&gt;
Confirm Password&lt;br /&gt;
&lt;input type="password" name="confirmpass"/&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p class="submit"&gt;&lt;input type="submit" value="Create my Account"/&gt;&lt;/p&gt;

&lt;/form&gt;

&lt;?php
$pass = $_POST['password']; 
$cpass = $_POST['confirmpass'];
$cmp = strcmp($pass, $cpass);

if ($cmp != 0)
{
    echo "check password";
}
else
{
    return true;
}
?&gt;
</code></pre>
