Posts by Victor Carnaval • 2,430 points
111 posts
-
-3
votes1
answer26
viewsA: How to exchange vowels of a string for numbers?
const str = 'carro'; console.log(str.replace(/a|e|i|o|u/g, 1));…
javascriptanswered Victor Carnaval 2,430 -
0
votes1
answer25
viewsA: How to take the value of a state and send to another page using React-Native?
You can use the component properties to pass the selected value and the function that updates this value. Remove from the constructor the status setor_selecionado. // PickerCadastroAdm.js…
react-nativeanswered Victor Carnaval 2,430 -
1
votes1
answer30
viewsA: Merging columns in the CSS grid system
You can solve this using the unit of measure fr. The unity fr represents a fraction of the available space in the container grid. Go to documentation .row { display: grid; grid-template-columns:…
-
0
votes1
answer49
viewsA: Datalist with array
Documentation is an excellent piece of content that can help you learn. In HTML documentation there is a detailed explanation of the objective of the element input and its objective. The html…
-
0
votes1
answer20
viewsA: Warning: Each Child in a list should have a Unique "key" prop
I suggest you read the topic of react documentation for more details but I will leave the excerpt pertinent to your problem. key is a special string attribute that you need to define when creating…
-
1
votes1
answer39
viewsA: How to make an edit function in an entire list with 2 inputs?
There is a better abstraction in the code you have made so far that can be applied to your app but I will help you with the code you have already written, because I believe you are learning the…
-
0
votes1
answer74
viewsA: Select elements ignoring specific items SIMPLE HTML DOM
Well, your question is not very clear but from what I understand you don’t want to select the elements tr of the nested tables. So to get only the elements tr which are children, you can use the…
-
0
votes1
answer47
viewsA: The button 1 show your content1, how to interact with others? Boot 1 show content 1, boot 2 show content 2...Thank you very much!
For these cases where certain elements need to have the same behavior but maintaining a distinction between themselves, I recommend using the attribute date. Date attributes-* allows us to store…
javascriptanswered Victor Carnaval 2,430 -
2
votes2
answers175
viewsA: How to call a modal using javascript or another language that works within HTML?
I believe your error is not the javascript code but rather where it is being rendered on your page. You need to ensure that the action of click of the button is executed when it is rendered, as…
-
2
votes2
answers1356
viewsA: Bootstrap Datepicker doesn’t work?
Your selector is incorrect. When you use the selector $('#datepicker input') means you are looking for an element in the DOM input who is the son of some element with the id="datepicker". To work…
-
2
votes2
answers91
viewsA: jquery: change the style of a div depending on the text/number in it
I created a function that will receive a number and return the class name for this. Also, since the numbers are dynamic along with the rest of your string, I made an instruction that "filters" only…
jqueryanswered Victor Carnaval 2,430 -
2
votes3
answers157
viewsA: How to do explode inside the $request->all() array
You can use the function strpos to find the position of the first occurrence of a string. How the function returns the numerical position of the first occurrence and you want the keys that start…
-
0
votes4
answers196
viewsA: How to mark and uncheck div (by checking and unchecking Checkbox) with jQuery
If only to change the state of div, the instruction $(this).toggleClass('active') would work very well. But how to change the input also, then another solution is to use the method hasClass to mimic…
-
3
votes1
answer2718
viewsA: Javascript calculator select operation type
What is missing in your code to solve the problem is getting the value of select to make the comparison. The method getElementById returns the element reference through of its ID, the element being…
-
3
votes2
answers165
viewsA: Why is there a conflict of days in the Carbon API?
To documentation of Carbon warns about this: By default, Carbon relies on the underlying Parent class PHP Datetime behavior. As a result Adding or subtracting months can overflow. If you are using…
-
7
votes1
answer3565
viewsA: How to get the month in Portuguese using Carbon?
The Carbon documentation notifies on the localization for version 1 of the API: Unfortunately the base class DateTime does not have any localization support. To Begin localization support a…
-
0
votes1
answer159
viewsA: PHP: Add new element to an array created from an object
From what I understand, you don’t want to add a property called shopping_nome in your class Cliente, right? Then you can add a variable called $key in the loop to get the iteration index. public…
-
1
votes1
answer236
viewsA: How to realize the Seed of a Factory within another class with Phpunit/Laravel?
I really like the Laravel framework for having a documentation excellent that has always met my needs. For your case, there is a paragraph (Programmatically Executing Commands) which explains how…
-
0
votes1
answer28
viewsQ: Get records that have equal values
I want to get the contact table records that have the same email. Only the email is a field of the email table because this way the contact can have several emails (One To Many). // Tabela contato…
-
3
votes1
answer37
viewsA: Recover POST when field name has score
To documentation of PHP says that points (.) and spaces of a variable are converted to underline (_). Dots and Spaces in variable Names are converted to underscores. For example <input name="a.b"…
-
3
votes1
answer102
viewsA: 'Incorrect datetime value[...]' when using bindParam or bindValue
Take a look at the code below: $sql = $this->db->prepare("INSERT INTO tb_teste (estrutura, foto, data_cadastro) VALUES (:estrutura, :foto, :data_cadastro)"); $sql->bindValue(':estrutura',…
-
0
votes1
answer178
viewsA: Migrations Laravel 5.8
You may not use the Schema::create twice for the same table. To add the foreign key you can use the same scope of the first create or use the Schema::table to make the changes.…
-
2
votes1
answer59
viewsA: Create current month searching array
Try this: $where = "MONTH(STR_TO_DATE(birthday, '%d/%m/%Y')) = MONTH(NOW())"; $this->db->where($where); $students = $this->db->get('student')->result_array(); foreach ($students as…
-
3
votes1
answer364
viewsA: Replacing ajax in a content call without refreshing the page
First, let’s clarify basically what it is Ajax. Ajax is an acronym for Asynchronous Javascript + XML according to the MDN Web Docs. Being more "short and thick", ajax is used to request the server…
-
1
votes3
answers92
viewsA: How to better organize the foreach
$titles = array('ID', 'Classe', 'Área', 'Valor', 'Local'); $resultado = array(); foreach ($dados as $value) { $valor = strip_tags(trim($value)); $xpl = explode(":", $valor); if (in_array($xpl[0],…
phpanswered Victor Carnaval 2,430 -
1
votes1
answer232
viewsA: Sum of hours in PHP/Mysql
I made a solution that solves your problem through recursion. $horasTrabalhadas = fixHour(11.40); // 11:40h $horasSemanais = fixHour(0.25); // 25 minutos $total = fixHour($horasTrabalhadas +…
-
3
votes1
answer67
viewsA: Inserting html in php
Try this: while($row_usuarios = mysqli_fetch_array($resultado_usuarios)) { $dado = array(); $dado[] = $row_usuarios["nome"]; $dado[] = $row_usuarios["preco"]; $dado[] = $row_usuarios["created"];…
-
1
votes1
answer45
viewsA: Query SQL returns data that was not to be returned
The inconsistency in the result is due to the fact that the dates are being compared as strings. Then the date 2019-07-24 is minor that 2019-06-30 following this model of comparison. To compare…
-
1
votes2
answers967
viewsA: Error adding and removing Uncaught Typeerror class: Cannot read Property 'classList' of null
I made small modifications to your code so that the error is no longer seen. Take a look: const selectMapID = document.querySelectorAll('.map a'); const selectArticles =…
javascriptanswered Victor Carnaval 2,430 -
1
votes1
answer127
viewsA: Submit confirm() the Cancel button does not work
$("form").submit(function(e) { e.preventDefault(); // Precisa prevenir o comportamento padrão antes de qualquer coisa const isConfirmed = confirm('Tem certeza que quer cadastrar o Tipo de…
-
1
votes2
answers74
viewsA: icheck plugin does not disable all checkbox
From what I understand of your problem, I do not think it necessary to use the plugin iCheck only to uncheck the checkbox. In the code I updated I left an instruction not to leave the third checkbox…
jqueryanswered Victor Carnaval 2,430 -
0
votes1
answer45
viewsA: PHP Codeigniter + mysql query
Try this: public function getItensDate($categoria = null, $start_date = null, $end_date = null) { $query = $this->db; $where = array(); $query->select('payments.sale_id, payments.paid_by as…
-
1
votes2
answers115
viewsA: Check available vacancies - Codeigniter
Try this: public function vagas_disponiveis() { $this->db->select('*'); $this->db->from('beneficios_calendario'); $query = $this->db->get(); $dias = $query->result_array(); //…
-
4
votes2
answers113
viewsA: Keep gif for a while after removing the mouse
To be quite honest, I don’t know if it’s possible to identify the period of animation of a gif. I would like the most experienced people in the community to address this issue. And another thing...…
-
0
votes1
answer335
viewsA: How to insert multiple data at once into the database coming from multiple inputs with the same name?
Like the attribute name of inputs is defined as an array, for each area and equipment dynamically added a new position will be created in the array with the new user-defined values. Then, in the…
-
0
votes2
answers170
viewsA: Blank, unanswered, email form - PHP
I believe the main error is in HTML. I noticed the missing tag closure form and the absence of the HTTP method type. The default value of form for the HTTP method is GET <div…
-
2
votes1
answer22
viewsA: How to create a new instance instead of pointing to the same instance when defining variable?
Use the reserved word clone. $data_limite = clone $data_inicio; Like the @Andersoncarloswoss said: The clone will make the cloning shallow, that is, the internal references if keep intact. If the…
-
0
votes4
answers96
viewsA: Dropdown with Javascript
const main = document.querySelectorAll('.main'); const lista = document.querySelectorAll('.lista'); main.forEach(function(el, i) { …
-
3
votes2
answers224
viewsA: Check if there is a percentage symbol (%) next to the number
Exchange the taxas.includes for taxas.indexOf. The function indexOf returns the character index in the string and if it does not exist, returns -1. if (taxas.indexOf("%") > -1) { console.log("Tem…
-
1
votes2
answers55
viewsA: Search for list of ids in mysql via php
You can use this way at the time of consultation. $ids = array('1', '2', '3'); $query = "SELECT * FROM users WHERE id IN (" . implode(', ', $ids) . ")"; // Saída SELECT * FROM users WHERE id IN (1,…
-
2
votes1
answer112
viewsA: Minute difference between two dates
function diff(datetime2, datetime1) { const miliseconds = datetime2.getTime() - datetime1.getTime(); const seconds = miliseconds / 1000; const…
-
2
votes1
answer397
viewsA: perform Insert with logged user code,in a table in the database
The mistake is in this part: ... VALUES ('$_SESSION['CodUsuario']', .... Since the string is being created from double quotes (") PHP uses an additional feature in the reading of the string. This…
-
3
votes1
answer61
viewsA: Heavy site because of images
First it is necessary to check whether the total size of these images is due to total amount or if they are poorly optimized. Also, thinking of the side of user, let’s assume that this feed site has…
-
1
votes1
answer65
viewsA: Jquery is adding the wrong values
This is happening because you are assigning the sum total to the base value of the treatment, which is the parameter used for the sum, that is, to each interaction with this value the same will be…
jqueryanswered Victor Carnaval 2,430 -
4
votes3
answers381
viewsA: Difference between Jquery.Append() and Jquery.Html()
Using the function append you add HTML code as the last child of the parent element. Let’s take the following example: <div> <p>Hello World</p> </div> When executing the…
-
1
votes2
answers57
viewsA: Loop(repeat) HTML/PHP
If your intention is to maintain the architecture of these arrays and print them you can use the following solution that has very explicit variables: $par = 0; $impar = 1; for ($i = 0; $i <…
phpanswered Victor Carnaval 2,430 -
0
votes4
answers44
viewsQ: Copy multiple records to the same table with change of values
I have the following query: INSERT INTO tags group_tags, title, active SELECT group_tags, title, active FROM tags WHERE group_tags = 2; First How to run this query for each table record that…
-
1
votes1
answer48
viewsA: Delete comma separated records
Since you were storing a "collection" of string values you need to understand what you are doing. All your documents related to a particular material are saved as a single value (string). So your…
-
2
votes1
answer110
viewsQ: How do I make a dynamic pagination run the same function it was rendered?
I’m dynamically rendering a view with the pagination defined and to perform this action I use the following function: $('#form').submit(function (e) { e.preventDefault(); const request = $.ajax({…
-
1
votes0
answers12
viewsQ: Why is the record removed when the Owner has been changed?
I created a method to alter the Owner of the records. $sql = "UPDATE Contato\Entity\Email t SET t.$column = :contato1 WHERE t.$column = :contato2"; $query =…