php - laarvel query builder output is messy -
i'm new laravel framework , faced problem , when send query results in form :
[{"visitors":3}] here code used result :
<?php echo $q = db::table('visitors')->select('visitors')->get(); ?> is there missed ?
this not best practice
<?php echo $q = db::table('visitors')->select('visitors')->get(); ?> following mvc pattern, should query in controller,
$q = db::table('visitors')->select('visitors')->get(); then pass $q in view. loop through $q results. if need specific result, $id = 3, use where.
Comments
Post a Comment