> I keep receiving the following error..( Error: user account already exists..
> ) although I don't have any data in my table. Any help would be appreciated.
>
> The code follows:
>
>
>
>
>
> <?php
>
> session_start();
>
>
>
>
>
> include ('dbc.php');
>
>
>
>
>
>
>
> if (isset($_POST['Submit']) =='Register')
As Jim already pointed out, if $_POST['Submit'] is set to ANY value this
check will be true. I think you want something like :
if (isset($_POST['Submit']) && $_POST['Submit'] =='Register')
> {
> if (strlen($_POST['email']) < 5)
> {
> die ("Incorrect email. Please enter valid email address..");
> }
>
> if (strcmp(isset($_POST['pass1']),isset($_POST['pass2'])) ||
> empty($_POST['pass1']) )
> {
> //die ("Password does not match");
> die("ERROR: Password does not match or empty..");
> }
>
> if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
> {
> die("Invalid code entered.
> Please enter the correct code as shown in the Image");
> }
>
> $rs_duplicates = mysql_query("select id from users where
> user_email='$_POST[email]'");
You should test $rs_duplicates !== false to be sure you have a valid
resource.
Have you tried retrieving the supposed row(s) and var_dump-ing them to
see what it thinks they are? My guess is, you're getting an error
message, which is why there is a row to be counted. You can't use an
array inside a double-quoted string like that, change it to be wrapped
in braces like:
$rs_duplicates = mysql_query("select id from users where user_email='
{$_POST[email]}'");
--
Niel Archer
niel.archer (at) blueyonder.co.uk
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php