So I'm writing a snipped of PHP code to log hits to my web site.
If I put the PHP code in-line, I can refer to $_SERVER['REQUEST_URI'] and $REMOTE_ADDR and the like and it writes it to the database properly.
If I put the code in a function, however, these variables get written to the database as null.
I'd rather put the code in a function than copy the code into every page I'm tracking. What's the elegant solution to this, minimizing the cut-and-paste code on every page?
Thanks!
If I put the PHP code in-line, I can refer to $_SERVER['REQUEST_URI'] and $REMOTE_ADDR and the like and it writes it to the database properly.
If I put the code in a function, however, these variables get written to the database as null.
I'd rather put the code in a function than copy the code into every page I'm tracking. What's the elegant solution to this, minimizing the cut-and-paste code on every page?
Thanks!