<?php


include "autoload.php";

function get_all_column_names()
{
    $db = new db();
    if(strlen($_GET['table_name']) <= 1) return "<option>NONE</option>";
    $result = $db->query($_GET['table_name'], "SHOW COLUMNS FROM " . $_GET['table_name']);
    $options = "";
    $options .= "<option value=''>NONE</option>";
    while ($columns = $result->fetch_assoc()) {
        // if($columns['Field'] == 'record_id') continue;
        $options .= "<option value='" . $columns['Field'] . "'>" . $columns['Field'] . "</option>";
    }
    return $options;
}


echo get_all_column_names();