Here is what I am trying to do:
class dataConnection
{
/**
* var definitions & constructor
* other methods
*/
//then
function dbDataReady(&$data, $key = "")
{
$data = trim($data);
if (!get_magic_quotes_gpc())
{
if (function_exists("mysql_escape_string"))
{
$data = mysql_escape_string($data);
} else {
$data = addslashes($data);
}
}
return $data;
}
}
/**
* the above class is actually included via require_once()
* and then instantiated (if not already) as this require / include
* occurs on each page. I instanciate the calss like this:
*
* if(!is_object($_SESSION["dataSource"]))
* {
*
* $_SESSION["dataSource"] = &new dataConnection;
*
* $_SESSION["dataConn"] = $_SESSION["dataSource"]->dbConnect();
*
* } else {
*
* $_SESSION["dataConn"] = $_SESSION["dataSource"]->dbConnect();
*
* }
*
* Now I want to use the method dbDataReady() with
* array_walk()
*/
array_walk($_POST, "don know what to put here?");
/*
* when the method is a local function, all is golden
* array_walk($_POST, "dbDataReady");
* but as a method, I can't seem to find a way to call the
* class and method.
* things like array_walk($_POST, '$_SESSION["dataSource"]->dbDataReady');
* will not work.
*/
What am I missing? Any ideas?
Kevin