public/lib/tps.php
/**
     * @param string $tablename the table to return information about
     */
@param string $tablename the table to return information about
@param string $tablename the table to return information about
public function listDatabaseColumns($tablename){
        $result = array();
        if($stmt = $this->mysqli->prepare("SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
                . "`TABLE_SCHEMA` = ? AND `TABLE_NAME` = ?")){
            $stmt->bind_param('ss', $this->databaseName, $tablename);
            $stmt->execute();
            $colName = "";
            $stmt->bind_result($colName);
            while($stmt->fetch()){
                array_push($result, $colName);
            }
            $stmt->close();
        }
        else{
            error_log($this->mysqli->error);
            throw new \Exception("failed to retrieve database tables");
        }
        return $result;
    }
public function listDatabaseColumns ( $ tablename ) { $ result = array ( ) ; if ( $ stmt = $ this -> mysqli -> prepare ( " SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE  " . " `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? " ) ) { $ stmt -> bind_param ( 'ss' , $ this -> databaseName , $ tablename ) ; $ stmt -> execute ( ) ; $ colName = " " ; $ stmt -> bind_result ( $ colName ) ; while ( $ stmt -> fetch ( ) ) { array_push ( $ result , $ colName ) ; } $ stmt -> close ( ) ; } else { error_log ( $ this -> mysqli -> error ) ; throw new \ Exception ( " failed to retrieve database tables " ) ; } return $ result ; }
@param string $tablename the table to return information about
@param string $tablename the table to return information about
//$result=["error"=>$mysqli->error];