Greetings,
I'm writing a custom MySQL class to help me with some of the repetitive functions and formatting we use. I store information such as the user/pass, hosts, and database name in a different file:
resources.php
<?php
$dbhost = "localhost";
$dbuser = "foo";
$dbpass = "bar";
$dbname = "foobar";
?>
And, in another file, I actually have the class definitions(example):
<?php
include_once('resource.php');
class MySQL
{
connect()
{
$mysqlcon = mysql_connect("localhost", "root", $dbpass);
if( !mysql_errno() )
return $mysqlcon;
else
echo "<div><div>DB Select Error: " . mysql_errno() . ": "
. mysql_error() . "</div></div>\n";
}
}
Now, I can see the variables set in resource.php outside of the class definition, but how do I get the reference the variables inside of the class definition?
Thanks!