comparing input value with a database value


I have written this piece of code to compare an input(username) which is an existing username registered from another table, comparing it with the DB field from another table

here is the piece of code which displays the first echo even if the number is available in a db

[php]$msisdn = $_SESSION[“msisdn_username”];


if ($msisdn_username==$msisdn)

$query = mysqli_query($con,“SELECT * FROM contract_information_tble where msisdn=’$_POST[msisdn_username]’”) or die(“could not get any data”);
$count = mysqli_num_rows($query);


else if ($count ==0)
echo "No match found in db for the username   "; echo$_SESSION[‘msisdn_username’];

} else {
while($row= mysqli_fetch_array($query))

echo ‘filed found’