I've never used that library but apparently your declaration is wrong, the line
PHP Code:
$Registry = registry::singleton();
Should be something like
PHP Code:
$Registry = new registry();
Your line is executing a static function called singleton from the class registry. What you need is to declare an instance of the class registry because you're calling methods of that class when using the -> operator.
Edit:
For the security, maybe some function to assemble the SQL constraints for that behavior.
A simple function that comes to me now is:
PHP Code:
function assembleConstrains($array = array())
{
//we will receive an asociative array
$flagForAnd = false;
$returnValue = "";
foreach ($array as $name => $value)
{
$value = str_replace("'","´",$value); //this line is to prevent SQL injections
if ($flagForAnd)
{
$returnValue .= " AND";
}
$flagForAnd = true;
$returnValue .= " " . $name . "='" . $value . "'";
}
return $returnValue;
}
That should be called like
PHP Code:
$sql = "SELECT * FROM table WHERE " . assembleConstrains(array("userID" => 1,"userPass" => 123 ));