Possible Duplicate:
Find duplicate records in MySQL
I am a newbe trying to find duplicates in a database with this function:
function uni($field, $value) {
$sql= "SELECT * FROM user WHERE ".$field." = '".$value."'";
$result = $pdo->query($sql);
$rows = $result->fetchAll(PDO::FETCH_COLUMN, 1);
return count($rows);
}
$username = $_POST['username'];
$result = uni("username", $username);
...i am about to bang my head against something solid. For some reason the query won't return a result and I dont know why.