Thread: Class Issue
View Single Post
  #1 (permalink)  
Old 10-01-09, 08:49 AM
Zefer's Avatar
Zefer Zefer is offline
Wannabe Coder
 
Join Date: May 2007
Posts: 190
Thanks: 2
Thanked 0 Times in 0 Posts
X_X Class Issue

Hello,
I am currently working on some code (class based) and I am wondering how I could make one class have a default - and permanent connection to a MySQL database.
Some pseudo-code of how I wish for this to work would be;
PHP Code:

class hooks {

 public function 
fetch_code ($hook_id) {
  return 
$this->ms_query("blah blah blah");
 };
}; 
But I would not like to have to write ms_query in that class itself. Any ideas?
Thanks in advanced,
Ryan
__________________
I know how to code in: JavaScript, PHP, (x)HTML, CSS, QuickBasic, VisualBasic
I'm learning to code in: C++ and Python

If my post was helpful, press the thanks button below.
Reply With Quote