$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));
     break;
 case 'generate_all':
     //User decided to generate all classes - so we'll create them in the "auto-generated-files" folder
     $row = array();
     $serverType = isset($_POST['serverType']) ? $_POST['serverType'] : '';
     $tableList = "";
     $allTables = array();
     $allTables = $connection->returnTableNames();
     deleteAllGeneratedFiles();
     $success = true;
     $msg = "Succesfully generated files";
     foreach ($allTables as $tableName) {
         $connection->table = $tableName;
         $result = $connection->ReturnColumnData();
         if ($result) {
             $template = new ClassTemplate($tableName, $result, $serverType);
             $template->SetAllColumns($result);
             $class_whole = $template->GetDeclaration_WholeClass();
             file_put_contents('c:/temp/phplog.txt', $class_whole);
             $currentPath = __FILE__;
             $withoutAjax = substr($currentPath, 0, strlen($currentPath) - strlen('ajax.php'));
             $pathToNewFile = $withoutAjax . 'auto-generated-files\\' . $tableName . '.php';
             $bytesWritten = file_put_contents($pathToNewFile, $class_whole);