I have a database table from which, when I select data with username and password, it works but when I insert some data in that table with same username and password it show
Make sure that you have an open connection to the database.
If you have separate functions for database connection and for insert values check the database connection is open or not.