I have a class that inserts information into a MySQL database. I have the connection variables set as fields at the top of the class. When I run the class it works perfectly.
I would like to simply store the class fields in a separate file (not a class but just the fields saved in a file) and include it inside my class. when I do this though, it doesn't work. Why is this?
GF
Here's the Code:
class RegChecker{
//set database connection fields
public $hostname_db_conn = "localhost";
public $database_db_conn = "thesis_db";
public $username_db_conn = "root";
public $password_db_conn = "";
......
}
I simply just want to take those four fields and store them in a simple php file and include it in place of them in the actual class e.g.
class RegChecker{
//set database connection fields
include ("db_connection_fields");
......
}
This doesn't work however.