Thanks Morgan, the above queries worked.
Now the problem is if I visit
www.myforum.com/photoplog
It shows random images but there no data in the member upload, main categories or thumb field. And if you open an image, there are no comments or or an option to reply.
All this was there before and in admincp, I can see the categories. I have modified the permission of usergroups so it the gallery is accessible.
I've uploaded a screenshot just for your reference.