Hi all!
I'm new to class files and trying to learn.
I have a database class that just establishes a connection to the db like below. How would I use the the $db objects methods within a function like below. Do I have to extend the class or can I just pass the "$db" object to the function? How would you guys do it?
//Require DB Info
require_once(DIR_WS_CLASSES . 'db.class.php');
//Create DB Object
$db = new db_class();
//Open up the database connection.
if (!$db-> connect())
$db->print_error();
function get_invoice(){
$sql="SELECT * FROM ".TBL_INVOICES."
WHERE id = $_POST[rowid] ";
$r = $db-> select($sql);
$row = $db->get_row($r);
return $row;
}