Also note that I have replaced the code with the fresh code, yet it does not work. my assumption is that something has gone wrong with the database. I have deleted the course created through Web Service in the database as well. Can anyone outline which table may have created a problem here
Can you manually clear your theme cache?
Thanks Phillip for coming to my rescue.
I have cleared theme cache as well as applied purge all caches. That didn't do much help.
Do I need to delete some folders in filesystem when you refer to do it manually?
May I know where the folders may be residing. is it inside the moodledata folder.
Look in the database. Do you have a row in the mdl_couses table where id is 0? (In Moodle, an id should never be 0. It should always be a positive integer.)
If there is such a row, try deleting it, or changing 0 to an unused value. If possible, get into a state where you can delete that course through the Moodle UI.
You could also set-up a test Moodle installation, backup the database, run the tool on that and see if the issue happens again. If it does then you are in a position to compare the database with its backup in order to determine what changed and therefore how to fix the site.
Thanks alot for all your input.
In my course table, the id of site changed from 1 to 0 somehow. Changing that resolved the issue.
Thanks again to everyone