Posts by Allan Andrade • 6,409 points
206 posts
-
3
votes1
answer2986
viewsA: Copy value from one input to another
Can do with jQuery capturing the event keyup. Run the code below and see below an example working: // JavaScript (usando jQuery). $('#input1').keyup(function(){ $('#input2').val($(this).val()); });…
-
1
votes1
answer1130
viewsA: Alert system with jQuery
Can do using append $(body).append('<div id="dialogoverlay"></div>'); $(body).append('<div id="dialogbox"><div><div id="dialogboxhead"></div><div…
-
0
votes2
answers3539
viewsA: Listing folder files with PHP
Use normal bar instead of backslash on $path, in addition, add a bar at the end. What’s the matter with you: $path = "C:\FOTOS COOPERADOS 2013"; should look like this: $path = "C:/FOTOS COOPERADOS…
phpanswered Allan Andrade 6,409 -
2
votes1
answer492
viewsA: ajax post with dynamic input
Since there can be several elements with the same name, you need to check the value of each element. And the values can be placed on arrays, in the case one for the beginning and one for the end. I…
-
0
votes3
answers630
viewsA: Problem accessing api using jQuery $.ajax
This error is happening because your system has different protocol and domain from the AJAX call. Your AJAX request: https://api.thetvdb.com/ Your system: http://localhost:8080 To accomplish a…
-
4
votes3
answers398
viewsA: Declare Css for multiple identifiers
Depends on the situation: 1) If there are items with the class .item and that you want to apply a different formatting, you can separate with comma. See your optimized example: <style>…
-
2
votes4
answers1194
viewsA: Contents of a JSON in a table cell
Your JSON file is wrong as it should not have a comma at the end of the last item. Corrected version: { "inprog": "123", "queued": "00", "total": "103", "resolved": "101", "20days": "0",…
-
3
votes1
answer29
viewsA: Relatedd and two tables
In the example below, I created a alias for each table. SELECT l.*, c.* FROM lancamentos as l JOIN clientes as c ON c.id = l.cliente_id ORDER BY c.nome ASC It is not good practice to use asterisks,…
-
0
votes1
answer187
viewsA: Average values where fields are equal
Grouping through the GROUP BY, see an example: SELECT perg.pergunta, AVG(resp.resposta) as media FROM resp_pergunta_man AS resp LEFT JOIN pergunta_man AS perg ON (perg.codigo = resp.pergunta) group…
-
7
votes2
answers115
viewsA: What is the linux text editor command that I can see output in real time?
You can use the: tail -f nome_do_arquivo or: tailf nome_do_arquivo
-
1
votes2
answers458
viewsA: Search for next 7 days records in SQL
How are you utilizing a field of the kind DATETIME, accurate ensure that all records will return. For this concaten the beginning with ' 00:00:00' and the end with ' 23:59:59', in order to ensure…
sqlanswered Allan Andrade 6,409 -
2
votes2
answers12539
viewsA: Change color of a div using JS
Only the document. prefixing getElementById("corum").value; See below the code working: function trocaCor(){ var cor = document.getElementById("corum").value;…
-
4
votes2
answers299
viewsA: Compared to Datetime class, is the date function more performative?
Using a 512 RAM VM and 1 (one) processing core (i7), Debian 8 64bits, Apache 2.4 and PHP 5.6, I ran the following test, considering the same implementation used in the question: Using…
-
3
votes3
answers788
viewsA: Hide description with ''Display: None " bad for SEO?
It will depend a lot on what you’re hiding! Use the display:none; to improve the interface and user experience will not generate SEO penalties. However, if you do something to circumvent the search…
-
2
votes2
answers37
viewsA: Contenteditable attribute does not work
Just add the attribute readonly. <input type="email" name="email-empresa" id="email-empresa" placeholder="ex: seuemail@domínio.com" class="txt-input" value="[email protected]" readonly> Read…
-
1
votes1
answer2244
viewsA: Configure form for printing
Use the CSS to format the print, via a specific file for formatting or mark the changes for printing with the @media print: <!-- arquivo CSS específico para impressão --> <link…
-
6
votes4
answers23354
viewsA: Display text to mouse positioning over word or image
With pure CSS you can do so: #mostrar{ display: none; } #passar_mouse:hover #mostrar{ display:block; } <div id="passar_mouse">passar mouse <div id="mostrar">mostrar este texto…
-
1
votes2
answers266
viewsA: Problem when redirecting page, after printing using jQuery
You can try the function setTimeout to hold: $(document).ready(function () { // Remove o loading $(".se-pre-con").hide(); // Remove Menu topo $(".header").hide(); $('.content').css({ top: ("0px")…
-
2
votes3
answers163
viewsA: PHP - How to make sure that if a POST is not entered, it does not appear "Notice: Undefined index"
Could use the command isset to test if the value has been reported. In this way: <?php if(isset($_GET["email"])){ echo ($_GET["email"]) ; } ?> Note: You will notice that a lot of people use…
phpanswered Allan Andrade 6,409 -
4
votes1
answer519
viewsQ: How to measure the performance and costs (processing and memory) of a frontend?
I am working on a project that uses a lot of Javascript (ecmascript-6, jQuery), Html5, CSS and would like to have some way to measure the performance, the consumption of processing and the…
-
0
votes0
answers42
viewsQ: Which html markup for menu, which consumes the least browser resources?
Below is a simplified version of the HTML markup of a menu I use: <ul> <li><a href="#" title="Teste X">Teste X</a></li> <li><a href="#" title="Teste…
-
4
votes2
answers405
viewsA: HTML and Javascript integration
Need to add jQuery bookstore and also need to insert TAG SCRIPT for the Javascript code. Run the code below and see the script working. <html> <h1>Javascript</h1> <h3…
-
0
votes1
answer302
viewsA: Format JSON result with data returned every 30 minutes
You can try the following code: for($hora= 0; $hora < 24; $hora++){ $hoje = new DateTime(); for($minuto = 0; $minuto <= 30; $minuto += 30){ $data_hora = $hoje->format('Y-m-d') . ' ' // dia…
-
4
votes1
answer433
viewsA: Changing formatting of a link
With the a:hover (when the mouse goes over). See an example running the code below: /* CSS */ a{ text-decoration: none; } a:hover{ text-decoration: underline; } <!-- HTML --> <a…
-
2
votes1
answer148
viewsA: Is it possible to bypass (bypass) a regular expression?
In the above example the variable $rule is getting a pattern that matches anything non-alphanumeric. To validate alphanumerics, this pattern will probably be used to replace everything that matches…
-
1
votes2
answers39
viewsA: Filter result by date
You can try specifying the date and time: SELECT Id_produto AS Produto, Quantidade AS quantidade, genius.vendas.data_venda AS Periodo FROM genius.itens_venda LEFT JOIN genius.vendas ON vendas.Id =…
mysqlanswered Allan Andrade 6,409 -
1
votes2
answers600
viewsA: click on a button and appear the time within a div
See the code below working: $("#botao-entrar").click(function(){ $('#datetime').html(getDataHora()); return false; }); function getDataHora() { // variáveis var data = new Date(); var hora =…
html5answered Allan Andrade 6,409 -
1
votes3
answers683
viewsA: Find elements of a class Eno jQuery and add a parameter to them
See the code below working: // JAVASCRIPT $('#btn').click(function(){ $(".mudar").toggleClass('red'); }); /* CSS */ .red { background-color: red; } <!-- HTML --> <script…
-
0
votes1
answer1157
viewsA: How to hide an object in javascript
Follows a way to hide this HTML element: document.getElementById("form-tab-2").style.display = "none"; For testing: access the page URL with Google Chrome, then press F12, click "Console" option,…
-
2
votes2
answers117
viewsA: Recover parameter to filter in SQL: date and time every minute
It gets simpler with a loop for time and time for minutes. I separated a part of the code into a function to facilitate the understanding of the code: for($hora= 0; $hora < 24; $hora++){ $hoje =…
-
3
votes3
answers17426
viewsA: How to pass javascript variable value to php?
You are mixing FRONTEND (Javascript) codes with BACKEND (PHP) codes). It is possible to pass the value of the Javascript variable tipo_documento via Ajax to an archive PHP.…
-
3
votes1
answer9967
viewsA: PHP Accuses Curl Not Installed
This is because the Curl library is not installed and enabled. To enable in windows: Create a file called info.php with the content: <?php phpinfo(); Access the file URL cited above and locate…
phpanswered Allan Andrade 6,409 -
4
votes1
answer52
viewsA: select in elements that are not in the array
Use the NOT IN to filter and the implode to convert the array string, separated by comma. You can do it like this: <?php $idNaoEnvia = ['1', '3', '6']; $sql = 'select ID, NOME from comta where ID…
-
1
votes1
answer54
viewsA: Include with parameters
Yes it is possible! If you really want to accomplish include passing track parameter GET, should pass to Full file URL info.php. Example: include 'http://www.exemplo.com.br/info.php?page=sem nome';…
-
3
votes1
answer148
viewsA: Align form items with CSS
To put the label above the buttons: you must REMOVE the class 'class="form-inline"', and then assemble grid (adding <div class="row"> .... </row>) and defining the width of each field…
-
0
votes1
answer49
viewsA: Error in php connection file for mysql database
A visible error is the second parameter of mysqli_stmt_bind_param, which in your case should be "ss", representing string and string for login and password respectively. Soon, you must replace:…
-
6
votes2
answers4124
viewsA: Delete HTML Widget after a few seconds
To manipulate any information in the browser (without making a new request to the server) you must use Javascript. An example to remove the message after 5 seconds would be: USING CLASS…
-
3
votes1
answer919
viewsA: Modeling Categories and Subcategories
It is not necessary. The difference is between the data standardisation and the denormalization of data. Standardisation aims to avoid information redundancy and give more consistency to data.…
-
0
votes1
answer2025
viewsQ: "network failure" when downloading PDF generated with PHP’s FPDF class in Google Chrome
I have reports with generated in PHP (version 5.6) / FPDF (version 1.7) that are normally displayed in the browser window. The following simplified example on these reports are generated: <?php…
-
4
votes1
answer3455
viewsA: Load content from one div into another div
In their example, the two divs contained the class .conteudo. In order to avoid class name conflict, I changed the class name in the div that receives the content: from receber conteudo for…
-
1
votes2
answers87
viewsA: SQL Query Simple
You can use the following query: select a.NomeAluno , m.NomeMateria from TbAluno as a left join TbMateriasAluno as ma on ma.ID_Aluno = a.id left join TbMaterias as m on m.id = ma.ID_Materia Behold…
sqlanswered Allan Andrade 6,409 -
1
votes2
answers3391
viewsA: Validate captcha before sending form
In the method or function that handles the sending of the form, you can consult the Captcha via Ajax, then, if it is OK, you can submit the other form data.
-
0
votes1
answer140
viewsA: Check errors in PHP file run by external url
I went through the same situation some time ago, and I managed to debug consulting the server log files. In addition, I used the method error_log of PHP to record custom messages in the logo file in…
phpanswered Allan Andrade 6,409 -
1
votes2
answers323
viewsA: How to sort by average and quantity (weight)?
A way would be: SELECT dealers.id, COALESCE (AVG(rating), 0) AS media, COALESCE (COUNT(dealer_ratings.id), 0) AS qtd_avaliacoes FROM `dealers` LEFT JOIN `dealer_ratings` ON…
mysqlanswered Allan Andrade 6,409 -
4
votes2
answers59
viewsA: How to turn the first array of a multidimensional array into a key?
You can do it like this: $array_chaves = ['Nome', 'd_r_A', 'numero', 'numerodv', 'codtcart']; $array_nomes[] = ['Guilherme', '32132', '123456', '987654321', '987654321']; $array_nomes[] = ['Paulo',…
phpanswered Allan Andrade 6,409 -
2
votes1
answer100
viewsA: BD query without overloading the server
Yes it is possible. What you are wanting to do is DENORMALIZE a database for performance gain. Remembering that there is no "cake recipe" on normalization. It will depend a lot on each situation.…
-
14
votes4
answers1052
viewsA: How do we know the date is the last day of the month?
You can do it using the class PHP Datetime. Example function: function ultimoDia($data){ $formato = 'd/m/Y'; // define o formato de entrada para dd/mm/yyyy $dt = DateTime::createFromFormat($formato,…
-
1
votes3
answers4152
viewsA: PHP Parse error: syntax error, Unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING
Your code was misspelled, follows the correction of it, no change in your style: <a href='<?php if($dado['st_nome'] =="FINALIZADO"){ echo "dashboard.php?link=17&id=" . $dado["op_id"];…
phpanswered Allan Andrade 6,409 -
1
votes1
answer186
viewsA: Clear form fields when unchecking check
To clean up the input, just replace: $("#BancoFinanc").attr("value",""); for: $("#BancoFinanc").val("");
jqueryanswered Allan Andrade 6,409 -
4
votes2
answers7685
viewsA: Return correct php strtotime date
Can do using the object DateTime of PHP: $formato = 'd/m/Y'; // define o formato de entrada para dd/mm/yyyy $data = DateTime::createFromFormat($formato, "28/09/2016"); // define data desejada echo…