Posts by Rodrigo Tognin • 1,057 points
62 posts
-
0
votes2
answers19
viewsA: How to use select with php and Pdo
The return of function exec PDO only returns the number of affected rows. You are missing the Select result. You can use it like this: $stmt = $this->db_conn->prepare($sql_qr); // Atribuir a…
-
1
votes1
answer26
viewsA: Mysqli lastinsertid for PDO
Using PDO, the code would look like this: $imagem = "produto.png"; $insert = $con->prepare("INSERT INTO tbl_acomodacoes(acomodacao_imagem, acomodacao_situacao) VALUES(?,?);"); $sonuc =…
-
0
votes0
answers49
viewsQ: No return when fetching the Private Certificate Key
I need to sign a string with a digital certificate. However, when passing through the line that searches for the private key, the variable rsa is getting the NULL value, falling into the if and…
-
2
votes3
answers102
viewsA: Javascript performs the function without the button being clicked
Remove the call from the function btn.onClick = mudaTexto(); of the script code and assign it directly on the button, thus: <button id="btn1" onclick="mudaTexto();">1</button> This way…
-
0
votes2
answers843
viewsA: Get specific XML tag with PHP
Eliseu, you can upload the file and read it on a foreach, this way: <?php $arquivo_xml = simplexml_load_file('xml1.xml'); foreach($arquivo_xml as $tag => $val){ echo $tag . ' = ' . $val .…
-
0
votes3
answers98
viewsA: How to select a specific ul with jquery
Exists in css selector o :first-child You could use it like this: $('.menu-expand').click(function () { $('.menu-expand ul:first-child').toggleClass("menu-mobile-expandido"); }); The idea to select…
-
0
votes1
answer55
viewsA: Swap . html and css if mobile instead of m.mysite
One way is to add specific CSS s to each resolution. Some ways to inform CSS s for different resolutions: <link rel="stylesheet" type="text/css" media="only screen and (max-device-width: 480px)"…
-
0
votes2
answers253
viewsA: How to read two lines at a time from a text file?
Here is a suggestion of PHP code for you to read two lines: $txt - "arquivo.txt"; $hTxt = fopen($txt, 'r'); while (!feof($hTxt)) { $linha = fgets($hTxt); $nome1 = ''; $nome2 = ''; $cpf = ''; if…
phpanswered Rodrigo Tognin 1,057 -
0
votes2
answers105
viewsA: Input validation with Return in div
You can make some changes to make it easier. First in HTML, adding an ID in Input and calling the function on the button: <div class="input-group form-frete"> <input id="txtFrete"…
-
1
votes1
answer24
viewsQ: Use variable value to compose function calling command
When I begin to abstract in various functions my systems, this doubt almost always appears to me. I have the value "local" in the variable sPrg, and I need to concatenate with "Ctrl.save" to call…
javascriptasked Rodrigo Tognin 1,057 -
2
votes1
answer75
viewsA: insert commas into.txt file alignments
You can use the php substr function as you read the txt file, like this: $origem = 'origem.txt'; $destino = 'destino.txt'; $arqOri = fopen($origem, 'r'); // Abre o arquivo de origem para leitura…
phpanswered Rodrigo Tognin 1,057 -
1
votes3
answers254
viewsQ: Different comments on Javascript
I noticed that, at least in Notepad++, comments in the Javascript language are treated in two different ways, which are marked with two colors. When I use // and "/* ... */ appears in green and when…
-
0
votes1
answer41
viewsQ: Wait for consultation with the bank to give feedback
I’m making an appointment with Sqlite Bank. But the function ends up giving return before the consultation is performed. I am trying to solve this using a type of control while the query does not…
-
0
votes4
answers52
viewsA: Is my char checking logic wrong?
Gustavo, you can use break; and adjust some details of your code, such as closing the "}" for loop as well. Following example: for (int i = 0; i < line.length(); i++){ if (line.charAt(i) != ' '…
javaanswered Rodrigo Tognin 1,057 -
1
votes2
answers611
viewsA: Updating multiple Mysql lines and fields
Another solution I found in the link below using "ON DUPLICATE KEY UPDATE": https://tableplus.io/blog/2018/11/how-to-update-multiple-rows-at-once-in-mysql.html Below is the example code adapted for…
-
1
votes2
answers120
viewsA: Error in Python script
As far as I can tell, there’s one parenthesis left on line 7 and there’s an extra bracket on line 9. I believe that fixing this errors do not appear. I tested in an online python environment.…
python-3.xanswered Rodrigo Tognin 1,057 -
-1
votes1
answer95
viewsQ: Java in Eclipse: displaying many warnings
I’m starting to study Java using the Eclipse IDE, which has helped me a lot at this beginning in creating classes and screens. Would you like to know if it is normal for it to be displaying many…
-
1
votes1
answer149
viewsA: Expired date alias in Mysql
Eliseu, using Case When might help you. Here’s an example: SELECT CASE WHEN DATEDIFF(data_expira, CURDATE()) < 0 THEN "Expirado" ELSE data_expira END as Data FROM pl_misc WHERE pl_id = $xyz LIMIT…
mysqlanswered Rodrigo Tognin 1,057 -
0
votes2
answers39
viewsA: Complete number of query records
You can use the case when in Select for that. Follow an example of use: SELECT CASE WHEN valor = 0 THEN "-" ELSE mes END as mes, CASE WHEN valor = 0 THEN " " ELSE valor END AS valor FROM tabela; You…
-
1
votes0
answers35
viewsQ: Autofocus on an input causing the keyboard and first mauíscula to appear
I’m using Cordova to develop my app using HTML, CSS and Javascript. When I use the command "Prompt" for the operator to insert an item in my app, Android brings the text box correctly, but does not…
-
1
votes1
answer78
viewsA: Automatic PDO and MYSQL listing
Jose, I managed to do something here. From what I understand, I missed going through the data in $ress. Look at the code I made below and see if it meets you: $result = $conn->query("SHOW…
-
1
votes1
answer595
viewsQ: Unknown error in integration with Webservice REST
I am trying to make a POST type request using the components: Resrrequest, Restclient, Restresponse by Delphi Xe8. In the GET type integration I can do normally, I get the return normally from the…
-
1
votes0
answers305
viewsQ: Error when instantiating object inside a namespace
I’m trying to use the mpdf library to print in PDF. However, the following error is occurring when instantiating the library: Fatal error: Trait 'Mpdf\Strict' not found in…
-
3
votes1
answer172
viewsQ: XML tags being generated with prefixes
I am creating an XML file by Delphi and if I use the prefix when creating the first tag, the prefix "ns1" is added to all the tags that will come below, generating error in the integration with…
-
1
votes2
answers88
viewsA: Substr() does not work
The error is in the "concact" command, where the correct is "Concat".
-
0
votes1
answer628
viewsQ: Break line automatically on export to Excel by Delphi
I’m doing an export to Excel using Delphi. At a certain point, a text ends up being larger than the size of the cell, "popping" its contents out of the cell when opening the file . XLSX generated. I…
-
4
votes2
answers93
viewsA: Do you really need to specify the HTML element before the class in the selector of a CSS rule?
If there are elements other than div with the same class, when using the information div.classe1{}, class shall be applied only to the element which is a div, and shall not be applied to other…
-
0
votes3
answers951
viewsA: Txmldocument load from a String
You can change your code to use another class to work with XML, using the IXMLDocument. Test this: var lHTTP: TIdHTTP; Result: String; doc: IXMLDocument; { alterado para "I" em vez de "T" } alipay:…
delphianswered Rodrigo Tognin 1,057 -
0
votes2
answers1214
viewsA: Repeated values when making an INNER JOIN
Test do so: $sql = mysqli_query($conn, "SELECT DISTINCT p.* FROM tb_protocolo p INNER JOIN tb_certidao c ON c.id_credenciado = p.id_credenciado WHERE c.id_credenciado = $id_credenciado"); We are…
sqlanswered Rodrigo Tognin 1,057 -
1
votes1
answer34
viewsA: Problem in consultation
William, there may be some error in the assembly of the consultation. The word 'empresa' is without the dollar sign $. If it’s a variable, it’s incorrect there. In this case, the query returns…
-
0
votes2
answers51
viewsA: Save information if user leaves page
Use the example below: <body onunload="Funcao();"> More details on this site: https://www.w3schools.com/jsref/event_onunload.asp…
-
1
votes1
answer503
viewsQ: Two Ajax requests in the same function
When loading a page, I have two Ajax requests in sequence that fill two select s with options coming from different tables in the database. But only the first is executed, the second does not even…
-
-1
votes3
answers1083
viewsA: Onclick, With two "Actions" on the same button. PHP
Guilherme, follows a suggestion for this, using Javascript: HTML: <input id="botao" type="button" onclick="Funcao1();> Javascript: function Funcao1(){ // Faz o que você precisa // Altera a…
-
1
votes2
answers797
viewsA: Send data to another page
You can do that with session variables. On page A: $_SESSION['variavel'] = 'Valor da variavel'; On page B you capture the value passed: $var = $_SESSION['variavel']; Just one thing: at the beginning…
phpanswered Rodrigo Tognin 1,057 -
1
votes1
answer1128
viewsA: Refresh automatico PHP
Put this script on the page: <script type="text/javascript"> Redirect(); function Redirect() { setTimeout("location.reload(true);",60000); } </script> In 60 seconds, it will be…
-
2
votes2
answers2755
viewsA: SQL to load only part of a string
The SUBSTR command needs 3 arguments: SUBSTRING( string, start_position, length ) In this case the lines below can be replaced by: SUBSTR(observacao,INI) AS DE, SUBSTR(observacao2,LM) AS PARA, To:…
-
3
votes1
answer371
viewsA: How to access the property in a PHP object
When using json_decode, the string generates an Object within an array. See below how to proceed: $str =…
-
2
votes2
answers857
viewsQ: Calling a function with the variable name
I have a function that should be called, but its name is mounted dynamically, based on a variable that will come as parameter. Follow the functions as an example. The first one is called and takes…
javascriptasked Rodrigo Tognin 1,057 -
0
votes4
answers921
viewsA: Insert fixed text in Textarea
I suggest the placeholder property by inserting the text you want. Example: <textarea rows="4" cols="50" placeholder="Texto temporário"></textarea> However, when you start typing this…
aspanswered Rodrigo Tognin 1,057 -
0
votes1
answer24
viewsQ: Undefined object reading from Indexeddb (JS)
I’m using Indexeddb to record a simple table using Javascript. When selecting a record for change, it is read and loaded into the form. However, when trying to update it in the database it is not…
-
0
votes2
answers56
viewsA: doubts about php authentication
At the end of the php script, if Login is ok, add the line: header('location: login_ok.php'); Where "login_ok.php" would be the name of the page to be redirected.…
-
1
votes1
answer42
viewsQ: String to Stringstream conversion failure
I’m having a problem converting the contents of a String to Stringstream. The contents of the string are:…
delphiasked Rodrigo Tognin 1,057 -
2
votes1
answer60
viewsA: Return multiple elements by ajax
Instead of returning a json, you can ride on php the HTML structure that will be inserted in the page, inside the while. But first, I suggest you change the tags td for th, thus they will be…
-
2
votes1
answer726
viewsQ: Data returned in an array is duplicated
I am running a SELECT in the database through a function and returning the result as a multidimensional array, where each primary index refers to a record, and the secondary indices are the database…
-
3
votes2
answers1153
viewsQ: Add a bmp or jpg figure to a canvas in Delphi
It is possible to insert, via programming, a jpg or bmp image on a canvas? I am using the canvas in a Tbitmap at programming time because my application has no screen. It is called, creates the…
-
0
votes3
answers708
viewsA: How to check the return of a function
It returns True or False: if(!$Email->Send()) { echo A mensagem não foi enviada."; echo Mensagem de erro: " . $Email->ErrorInfo; } else { echo "Mensagem enviada!"; } More details of class…
-
-1
votes1
answer190
viewsQ: Fields losing Datasource property
I have a small project of some records here, using the Delphi XE8. sometimes when I change something in the project, all fields (Edit s and dbGrids) lose the "Datasource" property and have to link…
delphiasked Rodrigo Tognin 1,057 -
4
votes1
answer1008
viewsA: How to remove Mask in Delphi from a Maskedit
If you are mounting the mask like this: ##. ##-##;1;_ It means he’s literally saving the characters. To prevent this, use zero instead of 1, like: ##. ##-###;0;_ Thus only the numbers will be…
delphianswered Rodrigo Tognin 1,057 -
8
votes1
answer583
viewsQ: Use "Fieldbyname" or the associated variable?
When I have a ClientDataset, one MemoryTable or a Query, what’s the difference if I take the value of a field using FieldByName() or the variable associated with the field? In the example below, I…
-
4
votes2
answers695
viewsA: Validate string in number with php
You can use the filter_input function. Follow an example: $peso = filter_input(INPUT_GET, 'peso', FILTER_VALIDATE_INT); if (!$peso) { echo 'Valor inválido.'; } More examples here:…
phpanswered Rodrigo Tognin 1,057