I think I've been going about using PHP the wrong way. From what I've recently come to understand, all PHP code is "rendered" when the page is loaded, but just that once and that's it. So how would I go about doing something like this?
window.setInterval(tick,3000);
function tick(){
document.getElementById("time").innerText=" <?php echo date('s'); ?> ";
}
This just constantly updates the "time" div
to whatever time it was when the webpage first loaded, which is obviously not what I'm trying to do.
This is just an example; what I'm looking to do eventually is update a webpage with information from an ODBC connection via PHP without having to reload the webpage every few seconds. I'm new to PHP programming, and I keep seeing stuff about transactions and requests, but all of the examples I see are a little over my head, regarding forms and server databases. I'm not using a form, there's really no user interaction of any sort; how would I make something like this work?
I've got a version that works perfectly as long as I'm okay with refreshing the page every second or two, but if I leave it running for more than a couple hours the browser eats up all the memory and crashes, so I'm looking for alternatives that don't involve refreshing.
Also, since I know it's going to come up, the machine I'm putting this on doesn't have any sort of internet connection, and I'm trying to avoid installing any extra drivers or files, which is why I've been avoiding AJAX.