0
I have a Dashboard with 8 screens that request the BD. The main file where they are (home page) makes the requests with the load()
jQuery.
In the individual screen files, each of them does a BD search and most of them accompanied by calculations.
However, most of the time it works (with the help of cache sometimes), I get an error on the console like this:
Failed to load Resource: the server responded with a status of 500 ()
I still don’t understand the reason, I’m still new in PHP, I only know the basics.
- What will be the main reason for the problem?
- The code or something related to the server?
Here’s an example of how it’s being done:
// Arquivo PHP inicial
/*
* PHP + HTML
*/
<script>
$('#tela-01').load('path/tela01.php', function(){
$('.wait').fadeOut(500); // Remove o carregando
});
$('#tela-02').load('path/tela02.php', function(){
$('.wait').fadeOut(500); // Remove o carregando
});
$('#tela-03').load('path/tela03.php', function(){
$('.wait').fadeOut(500); // Remove o carregando
});
$('#tela-04').load('path/tela04.php', function(){
$('.wait').fadeOut(500); // Remove o carregando
});
</script>
Above is an example of how the screens are called.
// Arquivo individual
/*
* Outras Funções PHP
*/
$variavel = $pdo->execute('SELECT campo01, campo02 FROM tabela01 LEFT JOIN tabela02 ON campo01 = campo03 AND campo02 = campo04 WHERE campo00 = 1 ORDER BY campo01');
/*
* Cálculos de acordo com a pesquisa
* HTML + PHP
*/
<script>
(function ($) {
// Colocando os valores em gráfico e/ou valores nos devidos lugares
})(jQuery);
</script>
Above is an example of how are the files that display the data. These search in the BD and save the values in variables for the JS to place after or mount the charts (Chart.js).
I hope I represented the code well.
Apparently you are closing the query in the middle, after
campo03
.– Sam
Oh no, it was my typo anyway, sorry.
– Kamile Pimenta
Access your server log file, there will be detailed error message.
– Woss