consider the following file (db-com.php):
If you wish You may skip to the question below it directly while reading it in parallel.
echo "entered db-com.php";
class DBCom {
/**
* @var string Holds the query string.
* If the blank constructor is used, make sure to use the parametrized functions.
*/
var $queryString;
/**
* @var resource Holds the MySQL Resource returned by mysql_query function
*/
var $queryResult;
/**
* @var array Holds the entire array of the result.
*/
var $queryArray;
function __construct() {
$this->queryString = $this->queryResult = $this->queryArray = '';
}
function __construct($qS) {
$this->queryString = $qS;
$this->queryResult = mysql_query($this->queryString);
$this->queryArray = '';
}
/**
*
* @return array An array containing all the elements of the requested query.
*/
function get_query_array() {
if($this->queryString == '' || $this->queryString == "") {
die("Query String is Empty. Cannot Proceed.");
}
for ( $i = 0 ; $fetchedArray = mysql_fetch_array( $this->queryResult ) ; $i++) {
$this->queryArray[$i] = $fetchedArray;
}
return $this->queryArray;
}
}
now when in another file i write
require ( 'some_path/db-com.php' );
the damn thing doesn't even enter this file (i.e.) even the first echo statement doesn't get displayed.
This is not happening with any other class files. Only this type of class involving sql functions. So I even started a clean blank file, tested first that control enters it or not (it did) and then wrote all of this, saved it under a different name, and included it, and again this mysterious error popped out.
Please help!
Have I gone wrong somewhere (either in my code or in my question) ? the please correct me!