as your code stands its only checking the first row of the db, you either need to add a loop into it:
while ($row = mysql_fetch_array($result)) {
$check_user .= $row['user'];
}
or (which is better)
you need to change it to make it a little faster while still doing the same job:
$con = mysql_connect("localhost","","") or die(mysql_error());
$db = mysql_select_db("p",$con);
$sql = "SELECT * FROM u WHERE username='$uname' ";
$result = mysql_query($sql);
$check_user = mysql_num_rows($result);
if ($check_user == 1) { header("location: yoda.php"); }