I'm making a basic function for adding logs on admin pages. (Please ignore the values).
$sql = "INSERT INTO logs(query,userid,time,page) VALUES('$query',$userid,NOW(),'$pagename')");
I'm just attempting to have it in a function like this
function myfunctionforlogs(){
$sql = "INSERT INTO logs(query,userid,time,page) VALUES('$query',$userid,NOW(),'$pagename')");
}
In other pages, I'm hoping to call it as
myfunctionforlogs();
What should I do? And thanks!
Sorry all for the misunderstanding. I have about 10 admin pages and I have a table to record logs. The standard query is what I have posted above. Now, I don't want have that code in every single page, so I have a file named "func.php". I'm hoping I can have that query in a function, so I can just call the function when I want to in other files.