sath2206 wrote:How to display it in index.phtml????
If you really mean "index.phtml" that means it is likely a view template called by controller indexAction function. What you basically need is injecting your database mapper into the controller and use it to return the desired information to print on the view. This is what Album tutorial already covers.
However, (I might be wrong but worth to mention) I think you might be actually meaning to display the number in the "layout.phtml" as the number will be displayed no matter which controller is in charge by the requested route - like displaying total incoming messages as a badge on the "Messages" menu item displayed on navigation bar globally. In this case, I generally use the Application Module onBootstrap function to set a layout variable with the desired information and use it in the layout template like $layout->totalMessages.
Here is a sample for the second situation:http://stackoverflow.com/questions/18439364/how-to-pass-variables-to-layout-phtml-globally-in-zf2
Note: I will also post a similar situation into my blog at Online Book Catalog Application Tutorial
series soon but not at that step yet.