$stmt = $conn->prepare('CALL add_log(?)'); $stmt->bindParam(1, 'request log test', PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 50); $stmt->execute();
Googling the issue I discovered some interesting solutions other people use for database and 404 handlers, etc. In the end, I noticed someone saying their emulator was the issue. I loaded the site from my phone and sure enough only one request was logged.
Found out that the browser actually requests the favicon as a seperate request. To fix the double inserts, I added the following to my inde:
if($_SERVER['REQUEST_URI'] == '/favicon.ico') return false;
Hopefully this helps someone else!
Back to List Next Entry