Posts by Vinicius.Silva • 1,257 points
62 posts
-
0
votes2
answers183
viewsA: Is it possible to convert an integer into an Array in C or PHP?
In PHP you can do with the function str_split. <?php $num = 5634; $array = str_split($num); print_r($array);…
-
3
votes2
answers115
viewsA: Put JSON API output in PHP variable
You already have the answer with an object mounted by your wrapper, so just access the desired property. See the example below. <?php require_once("monitor.php"); $monitor = new SACNR\Monitor;…
-
1
votes1
answer40
viewsA: Radio Button from Ajax does not work
If the elements are being inserted into the DOM after the click bind, you need to delegate the click so that jquery can identify the clicked element. You can do this with the method .on() which is…
-
0
votes1
answer116
viewsA: Create an accessible variable in all controllers that use the same middleware
You don’t need to create a middleware for this. If this route is only accessed by authenticated users just have to check it with the native middleware of the Laravel. To recover user according to…
-
1
votes2
answers195
viewsA: How to remove class from other elements by clicking the button?
As you already have the popups curled in var pop... just go through this list and remove the class visible before displaying the target popup. var button = document.querySelectorAll(".popup-btn")…
-
1
votes2
answers37
viewsA: Doubt as to whether to exclude specific elements of the clone() function
Another possibility that complements @Sam’s reply and does not fit in a comment. var $clone = $('#allProducts').clone(); $clone.find("b, br").remove(); // console.log($clone.html()); //…
-
2
votes2
answers131
viewsA: Add time to date and time with PHP
You can perform this operation with the class Datetime together with the Dateinterval $row['data_saida'] = "2019-06-20"; $row['hora_saida'] = "08:35:02"; $row['tempo_viagem'] = "02:30:02"; $saida =…
phpanswered Vinicius.Silva 1,257 -
1
votes1
answer49
viewsA: Why did my jQuery stop accepting $ but this accepted "jQuery"?
It is good practice when using jQuery not to use directly $. There are some ways to reference $ just to avoid the mistakes you are having. Using a shortcut // Note que $jq pode ser qualquer nome de…
-
2
votes1
answer313
viewsA: sequential code error
The mistake itself is telling you what’s wrong. Warning: mysqli_query() expects at least 2 Parameters, 1 Given in C: Bitnami wampstack-7.1.13-1 apache2 htdocs mvpbx php case.php on line 28 The…
phpanswered Vinicius.Silva 1,257 -
0
votes1
answer419
viewsA: Check field only if it has any Laravel value
Of the documentation of Laravel. By default, Laravel includes the Trimstrings and Convertemptystringstonull middleware in your application’s global middleware stack. These middleware are Listed in…
laravel-5answered Vinicius.Silva 1,257 -
2
votes1
answer211
viewsA: Take variable from one function to another function within the same class?
Using only functions you can achieve this only if you return the desired value. function upPicture(){ $variavel = "Hello World!"; return $variavel; } function cadastraPic() { $variavel =…
phpanswered Vinicius.Silva 1,257 -
0
votes4
answers114
viewsA: Hide a DIV based on the value of a field
The ideal in this case is to print style="display:none" before rendering html with the programming language you are using according to the model value and use your js script only for future changes…
-
0
votes1
answer50
viewsA: Use function to compare value and mark radio buttom
You need to pass the index of the list of values you want to test in order to compare. See: $checklistIni = unserialize($row_rsRegistros['checklistIni']); function compara($array, $index, $valor) {…
phpanswered Vinicius.Silva 1,257 -
1
votes4
answers1262
viewsA: Take array value
If you know the length of the arrays and/or want to access only one specific item, you can access it directly by its index. $avariasIni = unserialize($row_rsRegistros['avariasIni']); // printa o…
phpanswered Vinicius.Silva 1,257 -
2
votes3
answers1601
viewsA: z-index doesn’t work because?
The property z-index only works on elements where the property position is present and at one of the following values:: position: Absolute position: relative position: Fixed position: Sticky In your…
-
0
votes2
answers719
viewsA: Total sum with multiple values dynamically using jQuery
Are you trying to listen to events that don’t exist in div. Events should be heard directly on the buttons and inputs of your cart. See the example below and try to adapt it to your need. var…
-
0
votes1
answer862
viewsA: Receive the value of a datepicker
You need to adjust 3 things in your code: Configure datepicker to perform form Submit when user selects a date Set the attribute readonly in the input to prevent the user from entering invalid dates…
-
0
votes1
answer212
viewsA: Group values from a multidimensional array with the same value and display in a table
Friend your initial array already has the list sorted by the ids, you just need to scroll through it and mount the table. <table>…
-
2
votes2
answers189
viewsA: Get the sum of last week’s records
Since you are already using the Query Builder you can use the following syntax: $usersemanal = DB::table('clientes') ->whereRaw('created_at >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL 1 WEEK))')…
-
2
votes2
answers371
viewsA: form Ubmit only with Enter key without button does not work
Creating a form without the Ubmit button is very bad (bad) for usability, you can analyze the biggest chats (Whatsapp, Telegram and etc.) all have this button. Not to mention that you submitting the…
-
0
votes1
answer346
viewsA: Pass data from a table to an input to update
You have some errors in logic let’s go to them: The button editar table does not need to be within a form because it will only trigger the action of opening the modal. It is not necessary to have a…
-
0
votes2
answers61
viewsA: How to cut a PHP string in <H2> tags
You can use a combination of explode with foreach to achieve the desired result. See: <?php $ingredientes='<ul> <li>100g de farinha de trigo</li> <li>1 ovo</li>…
-
0
votes1
answer341
viewsA: Relationship N to N with 4 tables in Laravel 5.6
You already have the relationships made based on this, just access them. foreach($usuario->atuacoes as $atuacao) { echo 'Modulo: ' . $atuacao->modulo->nome . '<br />'; echo 'Papel: '…
-
0
votes1
answer434
viewsA: Swap the Welcome view for another in Laravel 5.3
Let’s go to a brief check list to use views in the Windows. By default views are in the folder resources/views The call from a view must be separated by ., then to the call view('portal.home') the…
-
3
votes1
answer550
viewsA: Create a JSON and add elements dynamically
You don’t need to create the json as a string for later parsing. // somente para mock var Lime = { Guid: function () { return '123456789' } }; var messageCarousel = { id: Lime.Guid(), type:…
-
0
votes2
answers739
viewsA: Open page in PHP
Your code has some errors in the link declaration. You can also take the contents of else in your code and create a default page and associate the condition of the if in the variable itself $pagina.…
-
0
votes3
answers181
viewsA: Position a circular image in the center
Elements <img> are by default inline-block i.e., you can apply block styles (such as width, height, border) and they follow the text flow. Assuming that the image already in the desired size…
-
0
votes1
answer31
viewsA: Why don’t you create Foreign Key?
You need to set the table engine to Innodb: create table Computador ( ID int NOT NULL primary key AUTO_INCREMENT, Nome varchar(45) NOT NULL, Marca varchar(45) NOT NULL, Modelo varchar(45) NOT NULL,…
-
0
votes1
answer211
viewsA: Slow Ajax and Login Validation without running right
Ragnar your code apparently has no errors and I managed to run it with some small modifications. Are they: I changed of $user_ip = getUserIP(); for $user_ip = $_SERVER['REMOTE_ADDR'];. Look at this…
-
1
votes1
answer39
viewsA: Multiple validators in the form
Just enter "," and add new validators to the array. See the example: password: new FormControl('', [Validatots.required, Validators.minLength(5), Validators.maxLength(10)]), And so it goes.. Edit…
-
3
votes2
answers67
viewsA: Problems with resubmission of form in the POST method
You can include a js that disables the button to avoid multiple clicks. <form action="insere-produto.php" method="post" id="form-insere-produto" onsubmit="bloquearBotao('#btnSubmit')"> ...…
-
1
votes2
answers140
viewsA: Hide one div while the other is visible
Your function needs to receive one more argument in order to show hide. See below: function Mudarestado(el1, el2) { var ele1 = document.getElementById(el1); var ele2 = document.getElementById(el2);…
-
1
votes1
answer681
viewsA: Select with PHP PDO and Mysql with conditional query values
Your query syntax should be SELECT * FROM animal WHERE TIPO = :TIPO AND Status = :STATUS Regarding your logic for the optional conditions you started to think a good way when you thought of arrays…
-
3
votes2
answers751
viewsA: Problem in converting the input values into Real, example: R$ 20,00
You need to do some checking before formatting the value. They are: Remove the currency (R$) if the user type it Check whether the entered value is a number or not with isNaN See the code below: var…
-
0
votes2
answers141
viewsA: Error Methodnotallowedhttpexception in Routecollection.php line 218
Try switching from: {!! Form::model($equipe,['method'=>'PUT','route'=>['equipes.insereAluno',$equipe->id]]) !!} for {!!…
-
1
votes1
answer152
viewsA: How can I change the value of the input after a condition?
If you create the input already with the solved value of the condition you can do this directly in the attribute value of the element just solve this condition in a variable and concatenate it in…
-
0
votes1
answer80
viewsA: Manipulated image slide with database in Node.js
You are making the loop in the whole carousel container, the loop should be only in the elements .carousel-item that you want to repeat. You have yet to add the class active only on the first…
-
6
votes2
answers108
viewsA: Why doesn’t the <p> tag inherit your father’s color?
Your syntax is incorrect, you cannot have a paragraph <p>within another paragraph. If you change the children to an allowed element (within the tag <p>) such as a <span> You will…
-
1
votes3
answers109
viewsA: How to put 0.5s Transition in Tooltips
You need to adjust some things in your code. See below: Change the display:none and display: block for opacity: 0 and opacity: 1 respectively Remove all calls to :hover to apply tooltip formatting,…
-
2
votes1
answer52
viewsA: How to group records per day using Unix Timestamp?
Assuming that the field createdAt represents a time in Unix. If you create a day-formatted column, maybe you can use it to group the records. SELECT DATE_FORMAT(FROM_UNIXTIME(createdAt), '%d/%m/%Y')…
mysqlanswered Vinicius.Silva 1,257 -
0
votes4
answers80
viewsA: How to align a smaller text to the top of the parent element?
You get this alignment effect by setting the position of the parent element as relative and the position tag <span> as absolute alignment will occur by adjusting the properties top and…
cssanswered Vinicius.Silva 1,257 -
2
votes3
answers146
viewsA: write json sentences html
If you change your function LoadJsonData to receive a callback, you can do this. See: function LoadJsonData(callback) { $.ajax({ url: './Json/JsonSite.json', dataType: 'json', success: function…
-
0
votes1
answer164
viewsA: Count characters from a summernote class textarea. It does not count CSS characters, for example <b>
You need to listen to the event onChange of the very instance of summernote that in turn will pass you 2 parameters via callback contents and $editable, where Contents is the string with the html…
-
1
votes1
answer249
viewsA: Error while consuming Swagger api from the transparence portal
You need to include the domain demo.syspesca.com.br in the CORS list of the www.transparencia.gov.br if you have access to that government api. If you do not have this access, you can make a "proxy"…
-
0
votes1
answer70
viewsA: Return Websql query in a global variable?
Welcome to Stackoverflow, well let’s go down the stretch where you say: I need to return the Rows variable in another Function, to send via ajax for the PHP server and aramazenar in mysql. you have…
-
0
votes2
answers274
viewsA: Help Curl+ Sleep
Assuming you already know the ajax request flow (because you have tried jsonp), you can make a "proxy" system where you would make the ajax request to a specific file on your server and that file…
-
0
votes1
answer42
viewsA: JSON Problems to recover values
Maybe you’re having problems with the configuration php to access url with SSL. Try to perform the request by disabling this check with: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); You are also…
-
0
votes2
answers50
viewsA: Check if the code exists on another site (remote Extract)
You can do this in countless simple ways. In this answer I will quote two. PHP pure Javascipt with ajax jQuery PHP pure (with file_get_contents and strpos) <?php /** * Url do site a ser…
-
2
votes2
answers437
viewsA: Extract objects from an object array to create a single object with all items
You can try it like this: var source = [ { cachorro: 'Bob', gato: 'Mica' }, { dono: 'Jose', dona: 'Maria' }, { outros_animais: 'sim', animais: ['cavalo', 'vaca'] } ]; var parsed = {};…
javascriptanswered Vinicius.Silva 1,257 -
2
votes1
answer50
viewsA: Do JSON regex excluding element
Since the word "token" has 5 letters, you can indicate in regex to start marrying only if the subject has 6 or more characters. The regex was like this: ([A-Z_.0-9a-z-]){6,} And here you can see the…