Posts by Leonardo Barros • 898 points
45 posts
-
3
votes4
answers84
viewsA: Show the output of a custom vector
I also did but without using counter, only conditions, stay here as another example. for($k = 0; $k <= 16; $k++){ if(((($k-1) % 4) == 0 && ($k-1) != 0) || $k == 0){ echo "A"; echo…
-
1
votes1
answer31
viewsA: Return last value of each day in mysql
I believe that there are several ways to do this consultation Here’s an example I did and tested SELECT data, valor FROM `tabela` where data in ( SELECT MAX(data) FROM `tabela` GROUP BY date(data) )…
-
1
votes2
answers112
viewsA: Change value according to the input typed using Ajax without clicking a button
Changes the text for html $('#autosavenotify').html(msg); If you want to put the value on one input use .val(msg)…
-
2
votes1
answer20
viewsA: Error in generation of sql with datetime
Missing the conversion of the Object of Datetime for String, adds ->format('Y-m-d') in the getData() $inserir->bindValue (1, $_cliente->getData()->format('Y-m-d')); and in Nascimento as…
-
-1
votes4
answers620
viewsA: How to round off this number: 3084.08 SQL SERVER?
In Mysql SELECT ROUND(3084.087522295, 2); Exit 3084,09 Mysql ROUND() Function…
-
2
votes4
answers487
viewsA: IF condition according to option field selection
I set an example with the value as @Sam said var micro = "Micro Inversores"; var valor = 0; // Veja que eu coloquei a variável valor em um escopo global function addEventHandler(elem, eventType,…
-
4
votes1
answer124
viewsA: Focus on Input by clicking Link
Missed the # in the script $('#' + id).focus(); and in the password the id of this link focus-email and the right thing is focus-senha $( document ).ready(function() { $("#editarDados").hide(); })…
-
0
votes1
answer26
viewsA: Problem with Jsonresponse in my Symphony4 Controller
You missed a comma on that line return new JsonResponse(array('code'=>$code,'msg'=>$msg),
-
0
votes1
answer28
viewsA: Problem in Table Insertion
I changed some things and the result checks with the comment "use strict" function botao() { let contador = 1 let par = 2 let pares = ''; let soma = 0 while (contador <= Number(entrada.value)) {…
-
2
votes2
answers148
viewsA: Increase color hue
I set up this function that takes the HEX converts to DEC calculates the gain and converts again to HEX hex -> without the # ganho -> percentage from 0 to 100 return you can edit according to…
-
1
votes3
answers198
viewsA: How to add data from an array or json in PHP
You have to use the json_decode to be able to use the data in PHP, in the example I set the data and values of the athletes, using the athlete’s name as the index of the array. $json =…
-
0
votes1
answer39
viewsA: Simultaneous database login - efficiency
To validate if there are no multiple accesses with the same user, just check in the login if the user already has an open session, if any treat as it already does, otherwise access normally. The…
-
1
votes1
answer12
viewsA: Using draggable error when calculating the percentage
As @Sam said you have to discount the width of the button, I set an example with the correction. $('.drag').draggable({ axis: 'x', containment: 'parent', drag: function() { var largura =…
-
1
votes1
answer119
viewsA: Change file name when sending email
Only pass name as second parameter: $mail->AddAttachment($pathArchive, "novo_nome.pdf");
-
4
votes1
answer91
viewsA: Date|Time returning error
The error is in the file type to insert into the database. To enter the date in the database, you have to send as string, usually in the format Y-m-d and the return of the method getData() returns…
-
2
votes1
answer32
viewsA: Error passing Date as parameter
You can use Datetime, so you can define the type class ClientesModelos { private $idClientes, $data, $nome, $sobreNome, $nascimento, $documento, $telefone, $celular, $email, $senha, $bloqueio;…
-
0
votes1
answer618
viewsA: How to perform a Migration in Laravel, without excluding the other tables
Unable to execute the php artisan migrate:refresh without erasing the data because the refresh recreates the entities of the database. You can use Seeds and Factories to popular the database with…
-
-4
votes4
answers839
viewsA: Retrieve data from the logged-in user to use as the sender of the email in Laravel
To get the logged in user, if you are using Authentication you can use Auth::user(); Here you have an example of the use of mail in Windows…
-
0
votes1
answer277
viewsA: Filter a Select2 by selecting an ion in another
JS <script> $('#cliente').change(function(){ $.ajax({ url: '{{ route('sua_rota') }}', type: 'POST', data: { _token: '{{ csrf_token() }}', cliente_id: $('#cliente').val(), }, dataType: 'JSON',…
-
3
votes4
answers4894
viewsA: PHP returning wrong current time
Use date_default_timezone_set('America/Sao_Paulo'); to configure your spindle
-
0
votes2
answers152
viewsA: How to make a text field mandatory when one of the radio Buttons is selected?
You have to take the selected value in radio, then in JS you put if($('#radio_r:checked').val() == 'Empresa') { that will work
-
1
votes2
answers174
viewsA: Database does not recognize text with special characters even in UTF-8
Just remove the utf8_encode in update and select. Put in the bank connection mysqli_set_charset($conn, "utf8") to define the mysqli charset $conn = mysqli_connect($servername, $username, $password,…
-
1
votes2
answers135
viewsA: Send JSON Javascript data to PHP
In AJAX you pass the data directly, in dados : (JSON.stringify(atividades)), takes the JSON.stringify thus, dados : atividades, and in PHP you don’t need json_decode, puts a var_dump($_POST) to…
-
0
votes2
answers107
viewsA: Form validation with javascript
In your JS is written lenght and the right thing is length: function validar(){ if(document.form.telefone.value.length < 11){ alert("Esse campo precisa de 11 caracteres");…
javascriptanswered Leonardo Barros 898 -
1
votes1
answer394
viewsA: Populate input’s with Ajax database data
Your problem is the response of AJAX, to facilitate the use of the answer, use the json_encode in PHP and AJAX set the type to JSON. Example: <form method="POST" action="" id="formulario">…
-
1
votes2
answers153
viewsA: Convert decimal value to currency value
In this example, the pennies must always exist, otherwise the output will be wrong. $num = "1.154.500.00"; $valor = substr_replace($num, ',', -2, -2); $valor = str_replace('.', '', $valor); echo "R$…
phpanswered Leonardo Barros 898 -
1
votes1
answer102
viewsA: Work with two different filters in the same location
I built from your code an example, there are more direct and less verbose ways to do the same thing, however, I tried to make it more readable. <html> <head> </head> <body>…
-
1
votes2
answers694
viewsA: Pick up the return from one function to another in the Laravel controller
Missing put the $this Put it like this: $listacontatos = $this->getarrcontatos();
laravelanswered Leonardo Barros 898 -
1
votes1
answer29
viewsA: Set the name of the select input from the database
One of the many possible ways. <select class="form-control" name="contaPatrimonial" id="contaPatrimonial" onchange="this.form.submit();" <?php if(!isset($_GET["revenda"]) ) { ?> hidden…
-
0
votes2
answers51
viewsA: Change image size by java script (Document.getElementById("showw"). src="img/sua_imagem.jpg"
According to the documentation of jQuery, you can manipulate the CSS using the function .css(). In your case, .css( "width", "30px" ); And in the case of Youtube, Youtube Iframe API and Embed videos…
javascriptanswered Leonardo Barros 898 -
0
votes1
answer27
viewsA: How do I send including the database id in the email?
I put the answer in the example you posted, Important: Do not include the same file twice. the function mysqli_insert_id($conexao) returns the id of the last query made by the connection <?php…
phpmaileranswered Leonardo Barros 898 -
0
votes2
answers133
viewsA: If with tab active
Add bootstrap js to your code <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> The bootstrap itself already treats the active and changing the…
-
0
votes1
answer110
viewsA: Taking an SQL field value after function return
You can create a name (alias) for the MAX of the query, facilitates at the time of use. $sql = "SELECT MAX(cod_periodo) AS max_cod_pedido from periodo_edital"; and to recover the value that will…
phpanswered Leonardo Barros 898 -
1
votes2
answers29
viewsA: I am unable to create a dynamic Jjquery Div
You can keep html separate js by putting like this: <div style="display: none;" class="alert alert-success alert-dismissable"> <button type="button" class="close" data-dismiss="alert"…
-
0
votes1
answer34
viewsA: Query problems, I think, but no php errors
Along those lines $sqla = "SELECT * FROM admin WHERE $session_Nome='username_Admin'"; change the simple place quotes thus: $sqla = "SELECT * FROM admin WHERE '$session_Nome'=username_Admin";…
phpanswered Leonardo Barros 898 -
0
votes1
answer33
viewsA: Inner Join question with Prepared statement
Add after the $stmt->execute(); $result = $stmt->get_result(); and in the while($dados = $stmt->fetch_array()) { change to while($dados = $result->fetch_array()) {…
-
0
votes2
answers223
viewsA: How to render events in Fullcalendar by specific views?
To change the events you must remove the existing ones then insert the new ones I use $('#calendar').fullCalendar('removeEvents'); to remove events and update them. I set an example with your code…
-
0
votes2
answers32
viewsA: Change the name shown in javascript graph column
You can change putting after series: [{"colorByPoint": true, "name": "O que vc quiser aqui",
-
0
votes1
answer75
viewsA: Why do I get the statement: "Indice.push is not s Function"?
You are assigning the variable indice on line 9 an integer value, you have to add the value with push on line 9 as well.
javascriptanswered Leonardo Barros 898 -
-2
votes5
answers102
viewsA: doubt about select in css
In a quick way you can use the tag en <br>, or you can use CSS to add margin or padding depending on what you want to do. Edit: I didn’t notice that it was spacing between the options, it is…
-
0
votes3
answers107
viewsA: Receiving e-mail without data
In a quick and simple way, you can place the attribute in the email field required and can also change the type for email type="email", link has the list of browsers that support this change. You…
-
0
votes2
answers394
viewsA: How to generate a random 32-byte Javascript token?
Here has a very good discussion about UUID And here is an example you can find on the first link: function uuid() { return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^…
-
1
votes1
answer231
viewsA: Validation Lumen/Laravel does not work
In Postman, at the line where you selected raw, the right most is marked as text, switch to JSON (application/json).
-
2
votes2
answers140
viewsA: Calculate output per hour using HTML5 and PHP
Opa, as Lodi commented, it would be nice to take a look at the PHP documentation. This example here is using the class Datetime $inicio1 = new DateTime('10:00:00'); $fim1 = new DateTime('12:30:30');…
-
-1
votes2
answers520
viewsA: Capture session data with PHP and Mysql
You close the script before adding $idempresa in the session. Take this code $_SESSION['idempresa'] = $idempresa; and put inside the if($row == 1) { $_SESSION['idempresa'] = $idempresa; Edit: On the…