I’m having the “Server Error 200” problem. In my case, it has no filter and no other add-ons. The error occurs on both the local server and the web server. I use version 2021.0.15. The new record is added but the select is not updated.
You may check HTTP response in your browser.
After several tests I discovered that the problem occurs because I use a routine to select the database. Application works fully, except when trying to add record to a selection, as reported above.How can I solve?
Please enable Debug to see the error message in more detail.
In debug mode there is no error, only the message “SERVER ERROR 200: OK”. This message does not seem to be from the browser but from the application. In the browser debug, there is no error either. Tested on multiple browsers.
Macunaima wrote:
the problem occurs because I use a routine to select the database. >
Then you may post the routine you mentioned to select the database for more discussion.
The application works all other routines, only the inclusion of a record next to the select does not work. It includes the record but when updating the select it shows the error.
function Database_Connecting(&$info) {
$info["connectionInfo"] = ["CharacterSet" => "UTF-8"];
if(!isset($_COOKIE['Database'])) {
setcookie('Database',$_SESSION['contratoBD'],0);
} else {
global $contratoBD;
$_SESSION['contratoBD'] = $_COOKIE['Database'];
}
$contratoBD = $_COOKIE['Database'];
$vinculoBD = $_COOKIE['Vinculo'];
$info['host'] = "localhost";
$info['user'] = "user";
$info['password'] = "abcd1234";
$info['db'] = $clientBD;
//$info['dbname'] = $clientBD;
}
Are you sure your code is correct?
$info["connectionInfo"] = ["CharacterSet" => "UTF-8"]; // There is no $info["connectionInfo"]. What is your database type?
if(!isset($_COOKIE['Database'])) {
setcookie('Database',$_SESSION['contratoBD'],0); // Are you sure $_SESSION['contratoBD'] has value? When app first started (e.g. you just start up the web server), both the $_COOKIE['Database'] and $_SESSION['contratoBD'] are not set.
} else {
global $contratoBD;
$_SESSION['contratoBD'] = $_COOKIE['Database']; // Why save cookie to session, and then save from session back to cookie? Why not just use session or cookie?
}
$contratoBD = $_COOKIE['Database'];
$vinculoBD = $_COOKIE['Vinculo']; // Not used at all
$info['host'] = "localhost";
$info['user'] = "user";
$info['password'] = "abcd1234";
$info['db'] = $clientBD; // $clientBD not defined, did you mean $contratoBD?
//$info['dbname'] = $clientBD;
mobhar wrote:
Please > enable Debug > to see the error message in more detail.
It does not mean checking client side in browser, but check server side error in the log file on the server after enabling debug, you may follow the above post.
Thanks for the feedback.
Clean log file. There is no error on the server. All indicated procedures were performed without success. It doesn’t seem like an error from the Server or the Browser, but from the application, because the record is successfully included but does not update the SELECT. If you do a REFRESH in the browser, the record appears in the SELECT without error.
If something does not work, there must be some error either on the server side or on the client side. If your server side configuration is correct, you should see all the activities (e.g. SQLs) in the log file even there is no server side errors. If you don’t find the log file or the log file is empty, you have not enabled debug properly.
As explained in above post, there are many problems in your code which would not work unless you have fixed it.Assume there is really no server side errors, then it would mean there was client side (JavaScript) errors, you may use your browser to Debug JavaScript.Again, arbei wrote:
You may > check HTTP response > in your browser.
Press F12 in your browser, use the Network panel to check the HTTP response from the server after the record is added. Post the HTTP response, you should find either server side error or correct HTTP response.
header:Solicitar URL: http://localhost/asstec/asstec_us/api/add/eq_modelo
Método de pedido: POST
Código de estado: 200 OK
Endereço remoto: [::1]:80
Política do referenciador: strict-origin-when-cross-originresponse:
Warning: Attempt to read property “TableName” on null in D:\xampp\htdocs\asstec\asstec_us\src\AdvancedSecurity.php on line 1259
{“success”:true,“eq_modelo”:{“descricao”:“00”,“id”:“152”},“version”:“17.0.15”}
You better post your code around line 1259 in AdvancedSecurity.php for discussion.
if (CurrentTable()->TableName == “con_nivel”) { // Acesso
$tabela = 1;
}
if (CurrentTable()->TableName == “centrodecusto”) {
$tabela = 2;
}
if (CurrentTable()->TableName == “config”) {
$tabela = 3;
}
if (CurrentTable()->TableName == “fornecedor”) {
$tabela = 4;
}
if (CurrentTable()->TableName == “grupo”) {
$tabela = 5;
}
if (CurrentTable()->TableName == “icms”) {
$tabela = 6;
}
if (CurrentTable()->TableName == “marca”) {
$tabela = 7;
}
if (CurrentTable()->TableName == “entrada”) {
$tabela = 8;
}
if (CurrentTable()->TableName == “nivel”) { // Nível
$tabela = 9;
}
if (CurrentTable()->TableName == “pagamento”) {
$tabela = 10;
}
if (CurrentTable()->TableName == “produto”) {
$tabela = 11;
}
if (CurrentTable()->TableName == “servico”) {
$tabela = 12;
}
if (CurrentTable()->TableName == “usuario”) { // Line 1259
$tabela = 13;
}
if (CurrentTable()->TableName == “venda_lin”) {
$tabela = 14;
}
if (CurrentTable()->TableName == “troca”) {
$tabela = 15;
}
if (CurrentTable()->TableName == “cliente”) {
$tabela = 16;
}
if (CurrentTable()->TableName == “eq_tipo”) {
$tabela = 17;
}
if (CurrentTable()->TableName == “eq_marca”) {
$tabela = 18;
}
if (CurrentTable()->TableName == “eq_modelo”) {
$tabela = 19;
}
if (CurrentTable()->TableName == “os”) {
$tabela = 20;
}
if (CurrentTable()->TableName == “pagar”) {
$tabela = 21;
}
Try to change CurrentTable() to CurrentPage().
The error told that CurrentTable() is null. You should replace by CurrentTable()->TableName by CurrentTableName() and there is no need to call it multiple times at all.
It worked
Thanks