MySQL::GetColumnComments PHP Method

GetColumnComments() public method

Returns the comments for fields in a table into an array or NULL if the table has not got any fields
public GetColumnComments ( string $table ) : array
$table string Table name
return array An array that contains the column comments
    public function GetColumnComments($table)
    {
        $this->ResetError();
        $records = mysqli_query($this->mysql_link, "SHOW FULL COLUMNS FROM " . $table);
        if (!$records) {
            $this->SetError();
            return false;
        } else {
            // Get the column names
            $columnNames = $this->GetColumnNames($table);
            if ($this->Error()) {
                return false;
            } else {
                $index = 0;
                // Fetchs the array to be returned (column 8 is field comment):
                while ($array_data = mysqli_fetch_array($records)) {
                    $columns[$index] = $array_data[8];
                    $columns[$columnNames[$index++]] = $array_data[8];
                }
                return $columns;
            }
        }
    }