[eluser]polaris1927[/eluser]
I have defined a custom library function in
Code:
application/library/validate.php
This class needs to have access to a database, using
Code:
$this->db->get('business_names', $data);
Below is a code snippet from my validate.php class:
Code:
function contact($contact)
{
if( trim( strlen($contact) ) > 0 && str_word_count($contact) > 0)
{
//does this contact exist in database
$action = $this->db->get('business_names', array('name' => $contact));
if( $action->num_rows() == 0 )
{
return TRUE;
}
}
return FALSE;
}
BUT, I get the following error message:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Validate::$db
Filename: libraries/validate.php
Line Number: 54
Can annyone suggest a workaround?
Thanks.