php - Call to undefined function error -
i getting call undefined function
error, when have defined function. here code:
foreach($db->query("select * 'members' username = '$user'") $row) { echo "rank: ".get_rank_tag($user)."<br>"; }
here class get_rank_tag()
function
include('password.php'); class user extends password { private $_db; function __construct($db) { parent::__construct(); $this->_db = $db; } public function get_rank_tag($user){ try { $stmt = $this->_db->prepare('select rank members username = $user '); $stmt->execute(); $row = $stmt->fetch(); if($row['rank']==0){return "<span class='label label-default'>default</span>";} elseif($row['rank']==1){return "<span class='label label-success'>vip</span>";} elseif($row['rank']==2){return "<span class='label label-success'>mvp</span>";} elseif($row['rank']==3){return "<span class='label label-success'>elite</span>";} elseif($row['rank']==4){return "<span class='label label-success'>master</span>";} elseif($row['rank']==5){return "<span class='label label-success'>champion</span>";} elseif($row['rank']==6){return "<span class='label label-primary'>jm</span>";} elseif($row['rank']==7){return "<span class='label label-primary'>trusted</span>";} elseif($row['rank']==8){return "<span class='label label-info'>gm</span>";} elseif($row['rank']==9){return "<span class='label label-info'>gm+</span>";} elseif($row['rank']==10){return "<span class='label label-warning'>admin</span>";} elseif($row['rank']==11){return "<span class='label label-danger'>owner</span>";} } catch(pdoexception $e) { echo ''; } } }
i bit of beginner php, please bear me.
are sure have instance of user
class? sure have instantiated class php won't able identify function.
Comments
Post a Comment