Insert command denied in mysql

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 shows me the error

INSERT command denied to user 'username'@'localhost' for table 'tablename'

I searched using Google and someone else had the same problem with db size. I checked my db and when I go directly to phpmyadmin to insert data into the table, it works, but when I call a query to the table from a PHP script, it gives me the error.

Sounds like your MySQL user doesn’t have rights to use the INSERT command, in phpMyAdmin click on the Privileges tab and click the pencil next to the username your using and make sure that under Global privileges your user has INSERT, UPDATE, DELETE and SELECT privileges.

There is no Privileges tab in my phpmyadmin page.

I will take a guess and say your using cPanel, the only way to make sure your user is getting the correct privileges is by deleting the user and then re-adding it using the MySQL database wizard then you would need to re-attach the user to your database.

i have done this for three times. every time select query works for the same user but insert not working

You would need to contact your webhost about this as if your selecting all permissions for the user there shouldn’t be a problem.

U dont have permission for inserting values in the database…