Quote Originally Posted by Mindzai View Post
Just pass in the userid when you call the function. For example:

PHP Code:
function saveItem($userid) {
    echo 
"User ID: $userid";
}

$userid 66;
saveItem($userid); 
This may also help, especially the part about parameters.
Thank's for your helpful response, I've tried placing the $userid variable in a function and calling it but the value that is sent is still null.

If on the other hand I specify a value above the function call like in your example:

$userid = 66;
saveItem($userid);

Then the value 66 is inserted in the database.

But the value that I am trying to insert isn't a specific value like 66, rather it has been taken from the database and stored in a variable ($userid).

Is it possible for you to show me what the code would look like, based on my code for inserting value from the variable $userid in to the database?

- The insert query is in function SaveItem()