Posts by Rogerio de Moraes • 670 points
32 posts
-
-1
votes1
answer452
viewsA: Check for data in column
If it is to check only one column, make one SELECT counting the results, using as attribute, if the column is not empty (IS NOT NULL), in the clause WHERE. Then you’ll know if there are any results.…
-
3
votes1
answer453
viewsA: Use Node.js or PHP with Websockets?
PHP v NODE.js - The question that PHP loads everything again varies from one factor, whether PHP runs on Apache as a process, creating each request a new instance, or whether the same runs on…
-
1
votes3
answers12960
viewsA: What is the difference between double quotes and single quotes in Javascript?
Although there is no rule when using the two types of quotation marks, the most common is the atributo herdar aspas duplas (") and the argumentos do mesmo aspas únicas ('), if you want it is…
javascriptanswered Rogerio de Moraes 670 -
11
votes3
answers12057
viewsA: Differences between localStorage Vs sessionStorage?
sessionStorage - Is similar to a cookie that expires when you close the browser. it has the same extrusion as the localStorage, however there is no way to change your length of stay, whenever…
-
2
votes1
answer400
viewsA: Mysql Backup Restore does not insert all Tables
If the file in question is not damaged and the error is only (Primary and Foreign Keys), just perform this procedure in the backup file: 1 After the command use bancodedados; put the command SET…
mysqlanswered Rogerio de Moraes 670 -
1
votes3
answers1220
viewsA: Get timestamp
1st form function TimeStamp(){ return new Date().getTime(); } alert(TimeStamp()); Second form function TimeStamp() { var d = new Date(); var timestamp = d.getTime(); return timestamp; }…
-
1
votes5
answers29249
viewsA: How to calculate age based on DATE of birth in Mysql based on month and day?
1st form SELECT YEAR(CURRENT_DATE) - YEAR(c.nascimento) - (DATE_FORMAT(CURRENT_DATE, '%m%d') < DATE_FORMAT(c.nascimento, '%m%d')) as idade FROM clientes c Second form SELECT TIMESTAMPDIFF(YEAR,…
mysqlanswered Rogerio de Moraes 670 -
1
votes1
answer282
viewsA: How to change the format of a direct column in Mysql’s LOAD INFILE?
To make the change is quite simple LOAD DATA LOCAL INFILE 'planilha.cvs' INTO TABLE tabela_preco_produtos FIELDS TERMINATED BY ';' ENCLOSED BY '"' LINES TERMINATED BY '\n' (codigo, produto, @var1)…
mysqlanswered Rogerio de Moraes 670 -
1
votes1
answer4082
viewsA: Remove Mysql root after creating another user with all privileges
I recommend replicating on all machines (Host) users (Users), being the standard: CREATE USER 'usuario'@'%' IDENTIFIED BY 'mypass'; GRANT USAGE ON *.* TO 'usuario'@'%'; GRANT ALL PRIVILEGES ON *.*…
mysqlanswered Rogerio de Moraes 670 -
4
votes5
answers10782
viewsA: What is a Mysql Transaction for?
Transaction (Transaction) in MYSQL nothing more than an execution control, that is, if the requests are satisfied, the same is accepted, otherwise the database undoes all changes associated with…
-
0
votes3
answers2222
viewsA: What is a PHP Resource type? What is it for?
Resource - According to the official PHP documentation, it is "A feature is a special variable, which maintains a reference to an external resource. Resources are created and used by special…
phpanswered Rogerio de Moraes 670 -
0
votes7
answers367
viewsA: Is there a problem if I leave a php file containing only HTML code?
If the file only contains the template, without any associated password, there is no vulnerability, because a file without confidential data and that does not have write permission in the same…
-
1
votes2
answers5843
viewsA: PHP - Getting all images from a directory and generating in HTML
Instead of using $_GET, utilize $_REQUEST, with it the same url supports POST and GET. The way I used glob does not need to inform the path in the url in img. <?php $caminho =…
-
0
votes2
answers807
viewsA: Do not view PDF inside the browser
The way to do it in PHP is very simple <?php $file_url = $_GET['file']; header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition:…
-
1
votes4
answers24420
viewsA: Turning HTML into PDF
1º Make generate the pdf by an AJAX instance, in Jquery to be faster. 2º Run a url with the return of ajax, containing the file name, in another php file which will force the download. This way will…
-
13
votes9
answers13997
viewsA: How to create a website without reloading every click on a link?
Using Ajax is easy. Just follow my example below: <head> <title>Site</title> </head> <script…
-
0
votes1
answer58
viewsA: How to make a refresh more dynamic?
You can use Websocket, although indirectly the server procedure is the same, only run by a thread in the software application layer. In the case of Websocket there is a service/Thread that performs…
-
0
votes1
answer410
viewsA: I want to learn how to program
To understand logic, start with an "easy" language, such as PASCAL, C++ that are used together with the logic of programming in colleges and courses and then go to object-oriented and related.…
pythonanswered Rogerio de Moraes 670 -
3
votes8
answers67841
viewsA: How to export an HTML/PHP page to PDF
I recommend using html2pdf, it just needs to put the HTML content and output. <?php date_default_timezone_set('America/Sao_Paulo'); $content = "<!DOCTYPE…
-
0
votes3
answers2946
viewsA: Doubt with Javascript Replace
<script> var numero = '0,0000 %'; alert(numero.split(',').join('.').split('%').join('').trim()); </script> If you use a split to break the string and a Join to join, having some…
javascriptanswered Rogerio de Moraes 670 -
1
votes6
answers3314
viewsA: Get the local time in javascript with zeros?
Determining the output object (output) of the function <div id="hora"></div> Javascript to display the time <script> function pad(s) { /* Completa com zeros numeros com 1 digito */…
-
0
votes2
answers2553
viewsA: How to get database information without updating the page
I recommend using GET in Jquery. $.get("minha_pagina_acesso_banco.php", function(data){ $('#result').html(data); }); As you can see the code gets smaller, you can send and receive data like this.…
-
3
votes2
answers2404
viewsA: Calculate mathematical expression in string
Use eval, changing format does not influence anything. Example: var Variavel = 7*2+1/2; alert(Variavel); Displays the same value as alert(eval("7*2+1/2")); Just assign the value without Quotes.…
-
1
votes3
answers290
viewsA: How to fix this function, if I type something appears the same thing when I type nothing
first onsubmit is in the form, not the object, there are several ways to send the data of an element, when there is no more than one element with the same name, called by nomeobjeto.value is more…
javascriptanswered Rogerio de Moraes 670 -
0
votes3
answers387
viewsA: How does semantics/indexing work with Angularjs?
Crawlers (googlebot example) will use plain text reading, that is, first they validate meta tags, then comments, then they remove all coding and then read the whole text without code. Reason:…
-
0
votes2
answers497
viewsA: Query mysql does not work with variable - PHP
PHP $agenda=urldecode($_POST['agenda']); $query = mysql_query("SELECT * FROM `compromiso` WHERE login LIKE 'alanps' AND agenda LIKE '$agenda' AND ano LIKE '$ano' AND mes LIKE '$mes' AND dia LIKE…
-
1
votes3
answers12958
viewsA: Generate Excel with php query
There are some ways Force header for browser save with extension. Although it is a html with another extension excel accepts to load, in the form that this, without formatting if using external css…
-
1
votes2
answers4279
viewsA: Export data to Excel using PHP Excel
To generate your spreadsheets in the Brazilian standard, use the codes below Use for date <? $format = 'Y-m-d'; $dateValue = DateTime::createFromFormat($format, '2009-02-15');…
-
0
votes4
answers3804
viewsA: Lock CTRL key in All Browsers
Can use oncopy="return false" or oncut="return false" but not all browsers support it. An alternative way that works at all would be: window.onkeydown = function() { var key = event.keyCode ||…
-
3
votes4
answers9290
viewsA: How to place a gif before displaying the site page
Doing this is extremely simple and can be done for as long as 1.5 seconds, or just disappear when you finish charging. <img src='loading.gif' id='loader'/> <script>setTimeout(function(){…
-
1
votes2
answers245
viewsA: How to receive a title(title) from an image to the value of a variable?
You can get the title (title) so much for the id (ID), as by name (NAME) image, thus avoiding error if there are multiple images in the script, or inclusion of images above it. What would change if…
javascriptanswered Rogerio de Moraes 670 -
1
votes2
answers2050
viewsA: Download spreadsheet using the Phpexcel class
To generate XLSX use Define in $xlsName the name of the XLSX with the extension. Example: $xlsName = 'test.xlsx'; $objPHPExcel = new PHPExcel(); $objWriter =…