Posts by Hugo Leonardo • 835 points
25 posts
-
2
votes1
answer222
viewsA: Curl with false answer
I tried to test it here, but it was denied access. But see if it works like this: <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL =>…
phpanswered Hugo Leonardo 835 -
0
votes2
answers94
viewsA: Button to add numeric value, write to Postgresql database and display on screen with PHP
Here’s what I’d do. First, save a session in php: session_start(); $_SESSION['serie'] = 1; On the form screen, you can print the Session using sprintf, thus maintaining the desired format…
-
1
votes3
answers753
viewsA: CPF Regex with Laravel
Can do with pure php: $valor = str_replace(".", "", $valor); $valor = str_replace("-", "", $valor); $customer = Customer::where('cpf', $valor)->first(); I took the example of…
-
-1
votes1
answer1142
viewsA: Mask is not a function
I did something similar these days. I created a input to the phone and created this code for id: $(function(){ $("#txtTelefone").mask("(99) 9999-9999?9"); $("#txtTelefone").blur(function(event) {…
-
3
votes1
answer1420
viewsA: jQuery: Remove table row
Buddy, I had to modify your function a little bit, but I think it worked. I first took the row of the table we want to delete, looped it and applied its test. When it returns 'false' the row is…
-
1
votes1
answer484
viewsA: Uploading image to server does not work
In the Laravel 5.3, the recommended default is to save in Storage/app folder, which already has write permission. I usually use: $request->nome_do_campo_do_arquivo->storeAs('pasta_de_destino',…
-
1
votes2
answers355
viewsA: Foreign Key does not respect referential integrity
According to the W3 Schools the correct command would be as follows: ALTER TABLE compras ADD CONSTRAINT fk_compras_compradores_20161215 FOREIGN KEY (compradores_id) REFERENCES compradores(id) It is…
-
3
votes2
answers1842
viewsA: How to import ACCESS data to MYSQL
Uses the Access to Mysql. In this link has a tutorial (in English) on how to use: Bullzip.com/products/a2m/info.php.…
-
2
votes1
answer75
viewsA: Division of listed records into PHP Batches
I modified the code, see if it fits better: <?php $registros = []; for($j = 0; $j < 51; $j++){ $registros[$j] = "Registro " . $j; } $total = count($registros); $dividir = 10; $resultado =…
phpanswered Hugo Leonardo 835 -
4
votes2
answers1282
viewsA: Pass results from an Else if array
Buddy, I put the condition directly into the first loop: $meses = [1 => 'jan', 2 => 'fev', 3 => 'mar', 4 => 'abr', 5 => 'mai', 6 => 'jun', 7 => 'jul', 8 =>'ago', 9 =>…
-
7
votes3
answers2879
viewsA: How to know how many Sundays have php mysql months
You can get it month by month. I modified the example to make a loop: <?php $array = []; $ano = 2016; for($i = 1; $i <= 12; $i++){ $data = $ano . '-' . $i. '-01'; $inicio = new…
-
0
votes1
answer142
viewsA: Ajax warns success but does not insert data
Modify the way the data is set in date ajax: date: {'type': type, 'name': name, 'user': user, 'password': password}, Should work.
-
1
votes4
answers345
viewsA: How to select an option with value comparison?
After you take the state, do it like this: estado = 3; $('#estado').find("option[value='"+estado+"']").attr('selected', 'selected');…
-
1
votes1
answer526
viewsA: How to show a clock running the hundredth of seconds
I changed the code to display the milliseconds on the clock: <script language="JavaScript"> callerdate=new Date(2016,10,27,11,43,14); function showtime() { setTimeout("showtime();",10);…
javascriptanswered Hugo Leonardo 835 -
3
votes3
answers6551
viewsA: How to check if a value is date
It can also be done like this: <?php //pega a data $data = "03/04/2012"; //cria um array $array = explode('/', $data); //garante que o array possue tres elementos (dia, mes e ano)…
phpanswered Hugo Leonardo 835 -
1
votes1
answer41
viewsA: jQuery Menu function select url browser
See if that’s what you need: $(function(){ $('select').find('option').each(function(key){ if($(this).val() == 'http://www.test.com/page8'){ $(this).attr('selected', 'selected'); } }); }); <script…
jqueryanswered Hugo Leonardo 835 -
0
votes1
answer207
viewsA: Changing a PHP variable at the click of a button
You can pass the value of the $page variable as a function parameter: function buscaUser($user, $pageParameter = 1) { //...código anterior $page = $pageParameter; //...codigo posterior } I set the…
-
1
votes2
answers27
viewsA: Do not run event on just one page
You can use Jquery’s Hide() function: $( ":submit" ).click(function() { $("#escondido").hide(); }); <script…
-
13
votes3
answers182
viewsA: Convert date type 2016-10-04 15:51:16 to, 04-10-2016 15:51:16 to SQL or PHP how to do?
I use this script: echo date("d-m-Y H:m:s",strtotime("2016-10-04 15:51:16")); You can also turn this into a function: function formataData($data){ return date("d-m-Y H:m:s",strtotime(data)); } echo…
-
3
votes2
answers498
viewsA: Register of dependent picking ID of the respective employee with Laravel 5.2
I have an idea of what could be done. I just have no way to test here on my machine. Pass employee id on the new form route: Route::get('dependentes/formDpt/{id?}',…
-
2
votes4
answers3793
viewsA: How can I put a negative number in PHP?
You can create a method to always return the negative value of a number: function retornaNegativo($valor){ return -abs($valor); } $x = retornaNegativo(2); The function abs always returns the value…
phpanswered Hugo Leonardo 835 -
1
votes1
answer30
viewsA: Popups/Modais Javascript
Buddy, take a look at this fiddle: https://jsfiddle.net/lossantis/2e1sfkge/10/ I made some changes to your html, because the two modals were with css in tags with different classes.…
-
2
votes1
answer431
viewsA: How to create validation to ask if the user really wants to leave the page?
Create a method to confirm the page output by passing the url as parameter: function confirmar(url){ event.preventDefault(); var resposta = confirm("Deseja mesmo sair da página?"); if (resposta ==…
-
1
votes3
answers224
viewsA: Take all content from a div and write at the beginning of a file
I would use a form with the data in a Hidden field: <form action='posts.php' method="post"> <input type='hidden' name='tipo' value='<?=$tipo?>' /> <input type='hidden'…
-
1
votes1
answer103
viewsA: variable does not load in pagination
I would change $_POST['busca'] for $_REQUEST['busca'], so the variable can receive both data by post how much for get. It would also send the search data in the pagination link:…