Posts by Marcelo • 1,768 points
151 posts
-
-1
votes0
answers11
viewsQ: Putting Prepare Inside or Outside the Loop? PDO + PHP
I use "prepare" PDO for everything, so optimizing my application I saw that I may be doing something "wrong" at the time and I didn’t even think it was the following: I have a "Database" class that…
-
-1
votes3
answers605
viewsA: Save a JSON file inside square brackets and separated by comma
I usually use old solutions, then I refine the code, for your case I would do so: <?php $dados = file_get_contents("dados.json"); $dados = substr($dados, 0, strlen($dados) - 1) . ","; //…
-
0
votes0
answers27
viewsQ: Optimize Mysql query with Sub Select
I was having a problem of slowness in a select as below: select vendas.codigo, vendas.cartao_tipo, vendas.valor, vendas.datavenda, venda.autorizacao, cliente.codigo, cliente.nome, cliente.cpf,…
-
3
votes3
answers75
viewsQ: Store data in DB vertically or horizontally?
I recently posted a question about number of fields in a table here: Number of Columns X performance in tables Now I am curious about the standardization in the creation of the table below, I have…
-
0
votes1
answer66
viewsQ: "echo" shows decimal number with comma instead of dot
I have this code in PHP 7: $total_pedido = 123.90; $frete_valor = 13.98; $total_geral = ($total_pedido + $frete_valor); echo ($total_geral); // Mostra 137,88 The result of the sum (137.88) which is…
-
0
votes1
answer134
views -
-1
votes2
answers247
viewsA: How to leave label on top of input
Maria Eduarda, this layout world is very complex due to the number of devices and existing browsers, so there are frameworks that make your life easier, but as a study to make this basic model you…
-
2
votes1
answer32
viewsQ: Cast in MYSQL X Performance
I’m trying to improve my Sqls in Mysql and PHP, in the analysis I ended up coming to a CAST function is increasing by at least 5X the search time as follows below: CUSTOMERS table where the DATACAD…
-
0
votes0
answers17
viewsQ: Push X Ajax X Reload
Today I use this function to update data from a page without having to fully reload it function fDashboardProgressao(tempo) { $.ajax({ type: "GET", dataType: "json", url:…
-
4
votes1
answer118
viewsQ: Number of Columns X performance in tables
I am working with Mysql 10.x in a table that already has 60 columns, but it turns and moves I need to include more columns, I usually dismember in several tables precisely to not create a very large…
-
-1
votes1
answer79
viewsQ: Is there any way to recover which Pdostatement in the PHP PDO was created?
You see, I use PDO in PHP to run my Querys, sometimes I use the same query in other windows and then I need to rebuild the same Query on the other page. What I have in mind: I want to save select on…
-
1
votes4
answers90
viewsA: Is there a difference in these two querys?
I have seen many Selects and Ifs within the programming, and I confess that I keep thinking about how one does to keep the code cohesive... of course a little attention helps, but the use of "()"…
-
0
votes3
answers1286
viewsA: Which is faster: NULL or NOT NULL (with an empty string)?
In a short answer I would say that you should opt for NULL in columns that do not require value even for practical reasons, for example you cannot enter an empty "" value in a date field for…
-
2
votes1
answer110
views -
0
votes5
answers412
viewsA: Save or not the commands used in Mysql
Mysql is roughly a data manager, it alone I would say would not serve for something practical, you should associate it to a programming language to display the results obtained through the Mysql…
-
1
votes1
answer97
viewsQ: Is there any way to reuse a window with the target form?
We know that by property target HTML form we can tell if the request window will open in the same window or in a new. When using target="_blank" a new window is opened, it makes sense even by the…
-
-2
votes1
answer253
viewsQ: How to know which select option was selected after opening the modal?
I am using the routine below to work with various options of the same modal, this is the correct way to do? $(document).ready(function () { $("#btnok").on("click", function () {…
-
0
votes0
answers41
viewsQ: How apps like Whatsapp and Facebook identify the Logos of websites?
Guys I need to send a link through Watshapp and I’d like him to show the logo on the message Taking a test for example with the website: https://locaweb.com.br it shows a logo the title (tag title)…
-
1
votes1
answer518
viewsQ: How to use this Modal bootstrap more elegantly?
I don’t know if the title is appropriate, but I’ll explain: In the example below I have a confirmation modal that can be called by several buttons and depending on the button clicked I take an…
-
-1
votes1
answer202
viewsQ: How to declare an array variable as global in PHP securely?
In the function below I receive a message that the form used is not safe... and even ignoring I am unable to collect the contents of the variable $a after function $a = array(); function teste1(){…
-
0
votes0
answers319
viewsQ: Update TIMESTAMP field in On Update Postgres
I have the following table: Create Table tb_teste( cod_key integer not null, data_cad timestamp not null default now(), data_atualizacao timestamp not null default now(), primary key(cod_key) ) In…
-
0
votes1
answer125
viewsQ: Is there any way to select a comparison of duplicate records?
I have a table with 57 fields, due to an oversight in the past did not create the REQUEST field as Unique Key Due to the use by more than one user on a screen of the system he ended up allowing the…
-
0
votes0
answers1760
viewsQ: Postgres using variables in SELECT
In Mysql we can do: SET @pedido = 123; Afterward: SELECT @pedido We have something like that in postgres? I have looked on the web, but only found in the construction of functions and procedures The…
-
0
votes7
answers54187
viewsA: Remove letters and special characters in a select
I use the tip given by @user6026, but I had problem with the slowness, it seems that the function is a little slow in execution, even with only due fields treated, I did several tests. As the idea…
-
1
votes1
answer152
viewsQ: What kind of data to store "2019-02-06T14:14:38+00:00"?
I am consuming an API that returns me a field date with that data: 2019-02-06T14:14:38+00:00 In my Mysql database I created a field timestamp, because he was the only close I could find. Well, I can…
-
1
votes1
answer179
viewsA: Acbrsat error after SNV update
After upgrading Abcrsat via SVN I needed to make two changes to my codes 1: of: ACBrSATExtratoFortes1.Margens.Topo := 5; ACBrSATExtratoFortes1.Margens.Fundo := 5;…
-
1
votes1
answer179
viewsQ: Acbrsat error after SNV update
I use Acbrsat in a box front, it happens that after updating Acbrsat by SVN my project does not compile more, gives error in the following lines if ACBrSAT1.Modelo = mfe_Integrador_XML then begin…
-
0
votes1
answer1575
viewsQ: You can open excel in Excel without Excel installed;
I am supporting a system that the programmer made use of Oleobject to open and read an Excel file It turns out that I work with brOffice and error Delphi when I try to open excel because the Ole…
-
1
votes0
answers101
viewsQ: Error in ABS PHP conversion?
I have the following routine: $saldisp = -13.02; // Resultado de uma operação matemática $valorpagar = "13,02"; // Coloquei o valor real que vem do Edit $saldodisp = (float) abs($saldisp);…
-
1
votes1
answer134
viewsA: Extension pgsql Does not load in PHP7.x
The Solution I Found Add this line to httpd.conf Loadfile "C:/Program Files (x86)/PHP/libpq.dll" Forcing apache to use the dll in php to be compatible with php_pgsql.dll
-
-1
votes1
answer134
viewsQ: Extension pgsql Does not load in PHP7.x
I am changing from PHP5 to PHP7 in windows 10 (development machine), all my settings have gone up good, Mysql, Firebird, PDO Mysql, PDO PGSQL, but the blessed Native PGSL does not go up, I have…
-
1
votes0
answers64
viewsQ: Is the PHP session not renewed when using Ajax?
I have a scheduling page where every 30 seconds send (in background) an ajax request to know what times are still available, if there is an error I show a popup (bootstrap) with error information,…
-
0
votes3
answers48
viewsA: compare sql tables displaying different result
I’ll put two examples where I want customers who have no sales 1 - SELECT DISTINCT.* FROM CLIENTES C LEFT JOIN VENDAS V ON(V.CODID = C.CODID) WHERE (V.CODID IS NULL) 2 - SELECT DISTINCT C.* FROM…
-
0
votes1
answer504
viewsQ: Can SSL Certificate be by IP instead of Domain?
I am developing a php/javascript application that makes use of the camera via browser to read barcode, in the tests I did locally works well, when I put online it does not open the camera and nor…
-
0
votes0
answers603
viewsQ: How do I know if a folder exists with Idftp Delphi?
I need to know if a folder exists in ftp I’m using the function below, but error: --------------------------- Debugger Exception Notification --------------------------- Project perfil.exe raised…
-
0
votes1
answer45
viewsQ: Detect field type sent in PHP POST
There is how to identify the type of field that is coming in a post? Whether it’s Text or Array? Example: I have listbox (select Multiple) and text fields in html, and in it the user may or may not…
-
1
votes1
answer2699
viewsQ: How to save Fastreport to PDF in silent mode?
I can generate the PDF from the code below: fdm.frxPDFExport.FileName := 'C:\PASTA_TESTE\ARQUIVO_TESTE.PDF'; frxReport.PrepareReport(); frxReport.Export(fdm.frxPDFExport); The detail is that it…
-
0
votes0
answers153
viewsQ: How to handle expired session within the 4.x bootstrap modal?
I have a system where the user chooses a date and time for scheduling, I increased the session time because the user needs to fill out a form with various information, it’s working beauty. It turns…
-
0
votes2
answers494
viewsA: How to focus an object after closing the modal bootstrap 4.x?
I have found a temporary solution and I will put to colleagues, who knows new ideas emerge... var obj = null; $("#btneditar").on("click", function () { var codcli = $("#codcli").val(); if (codcli…
-
2
votes2
answers494
viewsQ: How to focus an object after closing the modal bootstrap 4.x?
I need to focus on an object after closing the modal bootstrap In bootstrap.dialog (old) I can do because I can program in the close event of the close button close, but the close of bootstrap 4 is…
-
0
votes0
answers72
viewsQ: How to send a form with Targe Blank and redirect the current page without Crhome blocking?
I have the following scenario: In a form send the data via Ajax, at the time of return if: if (json.retorno == true){ $("#form_imprime").submit(); } If I put a button in the form and send via the…
-
4
votes1
answer219
viewsQ: curl_init php does not work in url friendly?
I’m doing some tests with curl_init php I happen to have the links like this: http://localhost/produto/novo Internally it accesses the new.php file, but I’m using htaccess to work with friendly Urls…
-
0
votes4
answers3942
viewsA: jQuery does not see content loaded via ajax
I decided as follows $("#meudiv").on("click", ".minhaclasse", function(){ // Aqui pego o valor do objeto clicado, no caso minha classe var valor = $(this).val(); alert(valor); });…
-
0
votes1
answer80
viewsA: Why are apache subdominios sending to the default site?
I was making a banal mistake... I was just changing: <VirtualHost sistema.empresa.com.br> DocumentRoot /home/empresa/subdominios/clientes ServerName sistema.empresa.com.br ... for…
-
0
votes1
answer80
viewsQ: Why are apache subdominios sending to the default site?
Today I have a PHP system that uses an IP, so it looks like this: http://200.204.203.345/system I’m setting up subdominios to answer the requests and stay that way http://sistema1.empresa.com.br…
-
1
votes1
answer287
viewsQ: How to check if a connection is "sleeping" in php?
I have the following script: $fp = @fsockopen($IPAddress, $newport, $errno, $errstr, (float) 0.5); if ($fp) { echo("Conectado\n"); } else { echo("Desconectado\n"); } This script checks if a given…
-
1
votes3
answers713
viewsA: Send a string name via post using javascript
The correct way to write the json data in your case would be var jsObj = {"nome": "Test"}; See which unquoted name would be a variable, but in your case is the name of the field that will receive…
-
1
votes1
answer527
viewsA: Query in 2 tables that have columns with the same name
When using Joins it is good to name the oxen and not use *, because this can bring duplicity of information and confusion as this your doubt. I imagine that in your Result you should have two ST and…
-
3
votes1
answer350
viewsQ: Select with SUM until sum B is equal to or less than A
I have two tables, products and lots: Products codigo qtdatual Batches codigo qtdlote validade A select example would be: SELECT P.CODIGO, L.QTDLOTE, L.VALIDADE FROM LOTES L INNER JOIN PRODUTOS P…
-
0
votes2
answers823
views