So instead of trying to continue with that route, I echoed your function to see what it gives me on my page.
Yes, it is wise to concentrate on specific portions on your code separately when you are in doubt.
Anyways, maybe that has nothing to do with it. What does the erro message mean and where do I go from here?
As you have noticed, the problem is that you changed the function signature of get_email(), but forgot to reflect this change in the caller. In other words, you are writing:
get_email($id);
instead of:
get_email($id, $db);
Putting back the use of the global in the definition of get_email "solves" this problem, but then you get back the same old tight coupling problem. The real fix is to change how you call the function.
I'm not sure what you mean (it means that you are trying to print an array as a scalar variable).
For example, you would get that if you tried this:
$array = array('hello', 'world');
echo $array;
instead of:
$array = array('hello', 'world');
foreach ($array as $value)
{
echo $value . ' ';
}