Howdy... 😉
I am having problem with passing an array item to an object... 🙁
I have class.php file...
<?
class db
{
var $link;
function db($DBhost, $DBuser, $DBpass)
{
$this->link = mysql_pconnect($DBhost, $DBuser, $DBpass);
}
function AddTerminal(&$oTerminal)
{
echo("Function AddTerminal()<BR>");
echo("oTerminal->getTerminalType : $oTerminal->getTerminalType<BR>");
echo("oTerminal->getTerminalName : $oTerminal->getTerminalName<BR>");
echo("oTerminal->getTerminalTypeID : $oTerminal->getTerminalTypeID<BR>");
}
}
?>
and I have saveRecord.php file...
<?
## This first line of Code is to load the database variables.
require('./Include.inc');
require('./class.php');
$oTerminal = array( 'getTerminalType' => '1',
'getTerminalName' => 'NSX PC001',
'getTerminalTypeID' => 'PC001'
);
foreach ($oTerminal as $key => $value)
echo("$key : $value<BR>");
$theDB = new db($DBhost, $DBuser, $DBpass);
$theDB->AddTerminal($oTerminal);
?>
When I run this saveRecord.php file on my IE browser, I get this...
getTerminalType : 1
getTerminalName : NSX PC001
getTerminalTypeID : PC001
Function AddTerminal()
oTerminal->getTerminalType :
oTerminal->getTerminalName :
oTerminal->getTerminalTypeID :
Which means that I get the value fine before I pass the array to the object, but somehow this is not available within the object... 🙁
I probably am doing something dumb here, but I cannot see what I am doing wrong... 🙁 (I'm trying to get used to this OOP thing but it isn't easy either...)
Any help would be appreciated... Thank you... 😉