Function Problem
Posted: Tue Jul 21, 2009 10:48 pm
Alrighty, so I'm in process of updating the way my script displays errors...
Here's the function:
Alright, in MySQL the information is:
Table: "errors"
Identification for the error: "Error" Example: "MOD_NON_EXIST"
And the text for the error: "ErrorText" Example: "The mod you are currently requesting does not exist."
I'm calling the function like this:
let's say I'm doing a num_rows check for SQL.
Although, in the end. The function returns nothing. I'm not quite sure, I've also tried calling it this way:
And
I'm kinda out of ideas, and it's probably a stupid mistake on my part..
Here's the function:
Code: Select all
function DisplayError($ERROR1){
//Getting Information for Requested Error.
$ERROR_QUERY = $hTbase->query("SELECT * FROM errors WHERE Error = '" . $ERROR1 . "'");
$ERROR = $hTbase->fetch_array($ERROR_QUERY);
$ERROR_TEXT = $ERROR['ErrorText'];
//Set HTML style for Error.
$ERROR_HTML_START = "<center><font color='red'>";
$ERROR_HTML_END = "</font></center>";
Return $ERROR_HTML_START . $ERROR_TEXT . $ERROR_HTML_END;
}
Table: "errors"
Identification for the error: "Error" Example: "MOD_NON_EXIST"
And the text for the error: "ErrorText" Example: "The mod you are currently requesting does not exist."
I'm calling the function like this:
let's say I'm doing a num_rows check for SQL.
Code: Select all
if($TeamNum >= "1"){ //If User is already on a team.
DisplayError(MOD_NON_EXIST);
}
else{
//Do Work then redirect to success page
}
Code: Select all
DisplayError('MOD_NON_EXIST');
Code: Select all
DisplayError("MOD_NON_EXIST");