I started the Windows 2003 server and tried to run such code every 15 minutes:
require("db_connect.php"); $conn = db_connect(); //list online brukere - flytt funksjon til separat side for bedre ytelse $time = time() - 900; $query ="SELECT username FROM tbl_user WHERE last_online >= $time"; $online_users; if ($result = $conn->query($query)) { while ($row = $result->fetch_assoc()) { $online_users .= $row["username"].":"; } $result->close(); } $filename = "online_users.txt"; $fp = fopen($filename,"w"); fputs($fp,$online_users); fclose($fp);
When I go to the URL or run it from the command line, it works and writes to a file. But the task just starts and does not save the file. What happened?
source share