<?php
    require_once('../../../server/api-adodb/config.php');
    require_once(LIB_PATH.DS.'loggedin.php');

    $tableName = $_POST['table_name'];
    $fieldName = $_POST['field_name'];
    $id = $_POST['id'];

    if(empty($tableName)){
        die("Please select a table.");
    }
    if(empty($fieldName)){
        die("Please select a field.");
    }
    if(empty($id)){
        die("Please select an id.");
    }

    $table = new Table($tableName);
    if($table->deleteColumn($id,$fieldName)){
        echo'success';
    } else {
        echo 'fail';
    }



    die;



    pr($row);die;

    if(!empty($_POST['table'])){
        $tableName = $_POST['table'];
    }else{
        die("Please select a table!");
    }
    $table = new Table($tableName);
    //Delete IDs
    if(!empty($_POST['ids'])){
        try {
            $table->deleteRows($_POST['ids']);
            echo 'Deleted!';
        } catch (Exception $e){
            echo $e->getMessage();
        }

    } else {
        echo 'Please select at least 1 item.';
    }

?>
