...... mysql_connect (localhost , $username ) or die ( mysql_error()) ; mysql_select_db ( $database) or die (mysql_error()) ; $query =mysql_query( "select *from $tbl where username='$username1' and password='$password' "); if ( !$query ) { echo " I am closing the connection " ; exit ; } else { mysql_fetch_array($query) ; echo "Welcome" ; } i am connected to the database have the username and password signed , builded the mysql_query and now i am trying to if the username and password are not correct then destroy , otherwise print "Welcome " will you guide me ?