$update_only = ''; $class_load = ''; $class_save = ''; $row = array(); $serverType = isset($_POST['serverType']) ? $_POST['serverType'] : ''; //Make sure that a table name was passed in if (isset($_POST['serverTableName']) && !empty($_POST['serverTableName'])) { $tableName = $_POST['serverTableName']; $connection->table = $tableName; } else { header('HTTP/1.1 500 No Table Was Selected'); header('Content-Type: application/json; charset=UTF-8'); exit; } $success = true; $result = $connection->ReturnColumnData(); if ($result) { $template = new ClassTemplate($tableName, $result, $serverType); $update_only = $template->GetDeclaration_UpdateablePart(); //$class_load = $template->GetDeclaration_Load(); //$class_save = $template->GetDeclaration_Save(); $class_whole = $template->GetDeclaration_WholeClass(); } else { $msg .= $connection->GetLastErrorMessage(); header('HTTP/1.1 500 Error retrieving table data: ' . $msg); header('Content-Type: application/json; charset=UTF-8'); exit; } //return a JSON encoded array header('Content-Type: application/json'); echo json_encode(array("whole" => $class_whole, "update_only" => $update_only, "success" => $success, "message" => $msg));