Hi There,
I’m rather new to php so please bare with me!
After many attempts i still have been unable to return success, even existing usernames still come up as free. ???
this is the code i’ve been attempting to use;
[php]<?php
}else{
$usr = new Users;
$usr->storeFormValues( $_POST );
if( $_POST[‘password’] == $_POST[‘confpass’] ) {
//passwords do match//
} else {
echo “Passwords do not match”;
exit;
}
$con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$stmt = $con->prepare(“SELECT COUNT (*) FROM users WHERE username = :username”);
if ($stmt->fetchColumn() > 0) {
echo “username is taken”;
}else{
echo “username is free”;
}
}
?>[/php]
Thanks, I Appreciate it!