if else statement not working, wont echo the else
<p>Hi there hopefully someone can help, </p>

<p>On one page I have a form where you enter an id number, on form submission if the id number is in the database it shows info from the database if not it should show no. Please see the code below, at the moment if you enter an id number that is in the database it works correctly and shows the database info, however if you enter a number that is not in the database it does not show anything and I want it to echo no. </p>

<p>I would be really grateful if someone could point me in the right direction.</p>

<pre><code>include '../book_classified_advertising/dbc.php';

$deletepost  = $_POST['webid1']; 

$result = mysql_query("SELECT * FROM class WHERE webid='$deletepost'");

while($row = mysql_fetch_array($result))
{
    if ($deletepost == $row['webid'])
    {
        echo $row['text']; 
    }
    else
    {
        echo 'no';
    }
}
</code></pre>
