if ( $a != $row1['ad'])
{
echo ''.$row1['ad'].'';}

Şeklinde sorunsuz olması lazım. En basit if yapısı bu :)