Just rewriting this class library I created and using bit different code (shorter and seemingly more safe and elegant)
Seeing I'm a dumbnut thought I'd ask what you think of coding like this:
Code:
//get the english name of an object of the specified type by the specified id
function get_object_name($id,$type) {
//get the translation id of the object, and then the english value for it in the translation table
if($result=$this->conn->query("SELECT translation_id FROM ".$type." WHERE id=".$id)){
$record = $result->fetch_array();
$result->close();
if($result=$this->conn->query("SELECT en FROM translations WHERE id=".$record['translation_id'])){
$record = $result->fetch_array();
$result->close();
return $record['en'];
}
}
return "Unknown";
}