Skip to content
Advertisement

How to print the sql count in a view?

I have this

JavaScript

But I don’t know how to print the result in a view ?

Advertisement

Answer

The select method will always return an array of results.

JavaScript

To print the count:

JavaScript

To print the result in a view you have to pass a variable:

JavaScript

Then print the result in your view:

JavaScript

To get more details about the database with Laravel, please check:

http://laravel.com/docs/4.2/database

To get more details about view in Laravel, please check:

http://laravel.com/docs/4.2/responses

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement