Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function info_table($tabela,$coluna){
- global $conn;
- $tabela = strtolower($tabela);
- $coluna = strtolower($coluna);
- $stmt = $conn->prepare('SHOW COLUMNS FROM '.$tabela);
- if($stmt->execute()){
- if($coluna == "accesslevel"){
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)){
- if(preg_match("/^access/i", $row["Field"]))
- return $row["Field"];
- }
- }
- if($coluna == "charid"){
- if($tabela == "characters" || $tabela == "heroes" || $tabela == "olympiad_nobles"){
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
- if ($row["Key"] == "PRI")
- return $row["Field"];
- }
- }else{
- $row = $stmt->fetch(\PDO::FETCH_ASSOC);
- return $row["Field"];
- }
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement