Would you mind pointing me to very basic examples of either of these options so I can wrap my head around this?
You see, I interpret option 1 (most likely interpreting incorrectly) as adding a parameter in another page like so:
$database->die_script("some query", "some error");
...which I don't (think I) want, since the end result should just need to be:
$database->die_script();
As for option 2, I was thinking:
function sql_failure_handler:
$error = $this->error;
$query = $this->query;
function die_script:
$this->sql_failure_handler($query, $error);
Or perhaps I need to do something like this from within die_script():
return sql_failure_handler($this->query, $this->error);
Am I on the right track at all? The other functions in the class are as follows:
function MySQLDB(){
/* Make connection to database */
//$this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
$this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die($this->sql_failure_handler($this->query($query), mysql_error()));
//mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());
mysql_select_db(DB_NAME, $this->connection) or die($this->sql_failure_handler($this->query($query), mysql_error()));
}
/**
* query - Performs the given query on the database and
* returns the result, which may be false, true or a
* resource identifier.
*/
function query($query){
return mysql_query($query, $this->connection);
}