Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ryanj's avatar
Level 1

Add timed loop to PHP sql query

How can I make this into a timed loop that checks this every 1 second? All of my attempts so far have broken the original code.

<div class="title m-b-md">
    People: @foreach ($people as $person) {{ $person->count }} @endforeach
</div>
0 likes
1 reply
realrandyallen's avatar

You'll either need to refresh the page through a meta tag or some javascript...though as a user I wouldn't want to be on a page that refreshes every second

If you don't want a page refresh you'll need to create a Vue component for this and inside there you can do an axios request to an api endpoint that gives you an updated list of $people

Please or to participate in this conversation.