Posts by Valdeir Psr • 10,804 points
433 posts
-
1
votes1
answer713
viewsA: Date function in Portuguese
To use dates with location on "en BR" (Brazil) or "en PT" (Portugal), the use of two functions: setlocale and strftime. The difference between date and strftime (beyond the parameters), is that…
-
2
votes2
answers880
viewsA: Jquery Ajax - Request problems every x seconds
The error is in the callback beforeSend. Like the Javascript is not finding the variable data and i, the Javascript ends the application and returns an error. In case you are receiving one JSON, you…
-
1
votes1
answer45
viewsA: Function returns Undefined value!
It turns out that the function onload is asynchronous and returns nothing, that is, it will only be executed when the image has fully loaded, so the desired value is not returned. When working with…
-
3
votes2
answers402
viewsA: PHP - array shuffle
You can also use the function RAND of Mysql. SELECT * FROM postpagina WHERE pagina='$tagsArray[$i]' ORDER BY RAND(); Thus the function mysqli_fetch_assoc, will already return the elements in random…
-
0
votes1
answer331
viewsA: Undefined offset error in Quotation Script
Definitely the explode is not one of the best ways to capture elements HTML of a code. Another point is that, on the site, there are no elements with the class Numbers. Instead of explode, you can…
phpanswered Valdeir Psr 10,804 -
1
votes2
answers34
viewsA: force an event from a button after deleting registration via modal
How are you using Materialize, just do it as follows: $('#btnDelteYes').click(function () { var id = $('#myModalDelete').data('id');…
-
1
votes1
answer89
viewsA: Get a record as soon as it is saved in the bank
The mistake The mistake is in query. Missed the FROM. The correct is: select * FROM sessoes order by id desc Below explains why you should not use this way to capture the last ID. Solutions Utilize…
-
0
votes1
answer17
viewsA: While with PHP and Datapicker
The attribute ID should be unique. When you have more than two elements with the same attribute ID. The Javascript will consider only the first. Instead of using ID, use other attributes like class,…
-
0
votes1
answer165
viewsA: Updating XML Data in Real-Time with jQuery.get
setTimeout serves as a "pause", it runs only once, in the programmed time. Already the setInterval, it creates an interval that will be repeated endlessly (or until you use the command…
-
0
votes1
answer78
viewsA: View data is disappearing at a certain time
The Problem What is happening is a problem with the time zone. As in Brazil we are in the time zone -03:00, we can make a simple calculation, since the server - usually - works with time zone 00:00.…
-
2
votes3
answers3696
viewsA: Webservice de CNPJ
As the question asks in PHP, I’ll answer that if anyone has the same question... In the PHP you have two options to download content from the web. You can use both the function file_get_contents how…
-
0
votes1
answer51
viewsA: Get content from flickr
Your code is not working because you are using curl_setopt as if it were a variable and not a native function of PHP. You too must close the connection after curl_exec. And if you don’t have SSL on…
phpanswered Valdeir Psr 10,804 -
0
votes1
answer275
viewsA: How to create a city selector before entering the site
As you did not give many details I will do something basic, but it will serve. Just you adapt later. We can work with Páginas Estáticas in the Wordpress, this will allow us to create, change or…
-
1
votes2
answers304
viewsA: Reset all fields (input, textarea) of the html page
You can also add an element button or input with the type="reset". Example: <form id="myForm"> Primeiro nome: <input type="text" name="fname"><br> Último nome: <input…
-
0
votes1
answer315
viewsA: Allow number-only queries in mysql
It is possible yes. Just check if it is an integer or value number and if it is not, display an error message. Using preg_match: <?php /* Verifica se a variável contém somente números */ if…
-
4
votes2
answers220
viewsA: Doubt about htaccess
As I don’t know how is your folder structure and how you are identifying the name of the artist and etc. I will leave a simple answer but you can adapt. Structure of the Folder: . ├── artists │ ├──…
-
3
votes2
answers5850
viewsA: How to generate event from checkbox marking or unchecking with jquery/javascript
Your second code is not working because, when the page is loaded, it checks whether the checkbox is selected (as by default it is not, returns false). As this value does not change, its condition…
-
2
votes2
answers611
viewsA: Download multiple images at once from a php site
You can do using file_get_contents and file_put_contents or Curl. The file_get_contents can read a local or external file. It is especially suitable for simpler cases. Although you have the freedom…
-
6
votes2
answers2683
viewsA: Create character pattern as in a CPF - Javascript
You can use Regular Expressions. Ex: ^([\d]{3})([\d]{3})([\d]{3})([\d]{2})$ └───┬───┘└───┬───┘└───┬───┘└───┬───┘ │ │ │ └───── Captura os dois últimos dígitos │ │ └────────────── Captura os valores…
-
1
votes1
answer400
viewsA: Click and act, click again and return to position/ Jquery
You can add a condition. If the element #settings is visible, shows a given name, otherwise displays another name. Ex: /* Caso a div #settings esteja visível, escreve "Voltar" */ if…
-
0
votes2
answers582
viewsA: Jquery Repeater - Repeat values in select
You can use the callback show to make a change before displaying the repeated element. In this function of callback we can use the jquery.each to go through all the selects already filled, check the…
jqueryanswered Valdeir Psr 10,804 -
2
votes3
answers532
viewsA: Changing site color via GET parameter
This is done using the global variable $_GET. With this variable you can identify the parameters used in URL. Ex: Url: https://www.example.com/? foo=bar var_dump( $_GET["foo"] ); //Output --> bar…
-
1
votes1
answer1039
viewsA: Browser "back and forth" button and dynamic div without refresh
First of all, your code has a lot of problems. One of them is that when the user clicks several times, the code only increases the number of requests. Ex: The user enters the site and clicks 5 times…
-
0
votes1
answer48
viewsA: Sigep API returns array with visibility of properties
It is not returning the object with its properties. It is returning a value that can be txt, json, xml etc.. But their code converts this result to the object PhpSigep\Model\CalcPrecoPrazoResposta…
phpanswered Valdeir Psr 10,804 -
0
votes1
answer27
viewsA: Multiple value with comma separation
All you have to do is concatenate the values. $id = $_COOKIE["id"]; $novoId = "Novo-Valor"; if (!preg_match("/\b{$novoId}\b/", $id)) { setcookie("id", $id .= ",{$novoId}"); } And to separate:…
phpanswered Valdeir Psr 10,804 -
2
votes1
answer480
viewsA: Browse Jsonobject Android
Well, actually that figure is a Jsonobject. A Object Array would be something like: Object[] arr = new Object[]; List<Object> list = new ArrayList<Object>; /* etc */ Back to the subject,…
androidanswered Valdeir Psr 10,804 -
1
votes2
answers152
viewsA: Divs background with a larger side q other
There are several ways to do this. You can use a div with the bottom in gradient. (Recommend) Background: linear-gradient (Ângulo, cor comprimento, cor comprimento, cor comprimento) Below is an…
-
6
votes3
answers520
viewsA: Why do line breaks between elements cause space between them?
According to the W3, all characters below are considered white space. ASCII space ( ) ASCII tab (	) ASCII form feed () Zero-width space (​) A line break…
-
4
votes1
answer244
viewsA: How to increment a div using For Javascript
When you use the repeating structure for, you are saying to go from number 0 to 9 (in your case), and to each repeat add the current number in the div indicated. As the process is extremely fast,…
-
0
votes1
answer239
viewsA: Like I’d do a div without refresh
You can do this in two ways. With iframe or Pjax = Pushstate And Ajax. Iframe The iframe is basically represents a browsing context. It incorporates an HTML page and thus allows you to have multiple…
javascriptanswered Valdeir Psr 10,804 -
1
votes2
answers50
viewsA: How to redirect to a page if url does not contain a word?
The exclamation mark ! serves to transform a false condition into true and vice versa. To compare with -1, you must remove that one ! from the beginning. $(document).ready(function () {…
jqueryanswered Valdeir Psr 10,804 -
1
votes2
answers1752
viewsA: How to verify if user has already been registered in the database?
Use the Preparedstatment when your query has "?" PreparedStatement statement = this.conn.prepareStatement("SELECT login FROM pessoa WHERE login = ?"); statement.setString(1, login); ResultSet rs =…
-
1
votes2
answers206
viewsA: Variable losing value in php
The problem is that you are not returning or storing the data in a variable that can be accessed later. You can change your "Viewed" class to: <?php class VisualizarDados { private $nome; private…
phpanswered Valdeir Psr 10,804 -
0
votes1
answer75
viewsA: Failed to load CSS
To base_url must have the base URL for the files to be loaded. When you inform "http://23.88.113.70/" (as it is on the site), the browser will try to load the files…
-
1
votes1
answer940
viewsA: Decoder data:image/png;Base64 with PHP
It is necessary that your server "inform" to the browser that it (the server) is sending an image, for this it is necessary to include the header Content-Type: image/jpeg, for example.…
phpanswered Valdeir Psr 10,804 -
3
votes1
answer36
viewsA: How to Capture This Array
It is necessary that you print the content on the screen. For this you will have to use two functions: json_encode and echo. The array_push will only serve to add the result of the variable $row in…
-
1
votes2
answers798
viewsA: Log user date, time and IP in Login
Add a UPDATE table ... after the if(mysqli_num_rows($buscar)>0) or create a Procedure for login verification or use the method multi_query of Mysqli. Ex: Mysql /* Opcional */ CREATE TABLE `users`…
-
0
votes5
answers12763
viewsA: PHP - Transforming object into array
To traverse a multidimensional array just use was foreach, or pass the index on foreach. Ex: foreach($array['Clientedata'] as $key => $value){ echo "$key: $value"; } If you don’t know the name of…
-
0
votes1
answer3044
viewsA: Uncaught Referenceerror: $ is not defined at funcoes.js:2
This is because the dollar sign ($) is a alias (or shortcut) to jQuery. That’s why you need to add jQuery jQuery before calling funcoes.js. Ex: <script…
javascriptanswered Valdeir Psr 10,804 -
1
votes1
answer3690
viewsA: Jquery mask for real currency
Perhaps the best option is to use the method toLocaleString $(".real").mask('#.##0,00', { reverse: true }); $('#vd_ga, #pvm_ga').on('blur', calculateValue); function calculateValue() { var vd_ga =…
jqueryanswered Valdeir Psr 10,804 -
4
votes1
answer206
viewsA: Replay audio every time a button is clicked - Javascript and HTML
Change the property currentTime of the element audio. playShot() { let audio = document.getElementById('shot'); audio.currentTime = 0 audio.play(); // É opcional caso o play já esteja em execução. }…
-
2
votes1
answer497
viewsA: Doubt about JS objects with array
Creating the products how to make an object that has array inside It is possible to create an object within a yes array. To do this just use the objects Array and Object. Example: /* Cria a…
-
1
votes1
answer2187
viewsA: How to flip an image with CSS?
TL;DR Add the prefix -webkit-. .body-element-p1{ top: 11%; left: 41%; position: absolute; z-index: 10; -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); -o-transform:…
css3answered Valdeir Psr 10,804 -
1
votes3
answers682
viewsA: Sum of an array and PHP value concatenation
Do it this way: $sum = array_reduce($arr, function ($a, $b) { if (isset($a[$b['tag']])) { $a[$b['tag']]['quantidade'] += $b['quantidade']; $a[$b['tag']]['pedido'] .= ",{$b['pedido']}"; } else {…
-
0
votes2
answers61
viewsA: comparison of dates with javascript
Just use the event onblur. This event will be sent when a particular element loses focus. You can pass the attribute onblur="comparadatas" date elements or use Js to define. I used js in the example…
javascriptanswered Valdeir Psr 10,804 -
3
votes1
answer2562
viewsA: findViewById(); with a variable within the method
No, it is not possible. It is necessary to pass the ID (which is a int), to capture the View through the method findViewById, but you can use a similar method. With the findViewWithTag you can…
-
2
votes2
answers2105
viewsA: How to save return in Ajax request in a variable
Ajax works asynchronously, that is, the request is sent and the rest of the code continues to be executed. To capture and display the return value of the request, you need to add these functions…
-
1
votes1
answer287
viewsA: Uploading images with added element in the image
One of the ways to do this is by using canvas and the events of Drag And Drop, natives, of the HTML5. Demonstration Download of the Project Dragging and dropping an object on the screen To use the…
-
1
votes2
answers496
viewsA: Upload webp images
This is done during the request. The code captures the parameter v (Or the browser checks the request headers), checks whether the image is in cache, if it is returns. If it is not, you can do it as…
-
1
votes1
answer32
viewsA: Apply JQUERY UI Revert Property
Add the property revert: "invalid" when informing that the clone object can be dragged. $(function() { $(".draggable").draggable({ helper: "clone", revert: "invalid" });…