I'm just starting to develop a new application and have decided to look at using PHP5 and look at using classes for some of the generic tasks.
I've had a read through a PHP5 book I've got but to be honest it doesn't really cover it in enough detail. Merely skims over the surface in about 10 pages!
Does anyone have any links to any good tutorials covering this subject.
Secondly can someone help me out with the following. Within the class I've written I am doing a db call and want to return the $sql_result to outside of the class.
When I try to print out the $test variable it returns blank, so I guess I'm not accessing the element within the class correctly.
Any ideas??
##############################################
class DbProcess {
// Constructor function
function __construct($sql){
$this->sql = $sql;
}
// Simple Select Statement
function Select(){
if($this->sql){
$sql_result = mysql_query($this->sql) or die(mysql_error());
}
}
}
#############################
$sql = "SELECT * FROM region";
// Create an instance of select
$query = new DbProcess($sql);
$query->Select();
$test = $query->sql_result;
#############################