Posts by Ivan Ferrer • 12,096 points
772 posts
-
2
votes2
answers6534
viewsA: How do PHP read the command line entry as a string?
For data entry in php use "argv": $argv[0]. Follow an example for entering a single parameter: <?php if ($argc != 2 || in_array($argv[1], array('texto1', 'texto 2', 'texto3', 'texto4'))) { echo…
-
1
votes1
answer917
viewsQ: How to set an initial date in this countdown done in Angularjs
I created a module in Angular JS that takes the current date of the clock and starts counting to the end, but I need to be able to set an initial date to start counting that is not based on the…
-
0
votes3
answers1211
viewsA: Data registration with Angularjs and PHP does not work
First we have HTML with angular: <!DOCTYPE html> <html ng-app="myApp"> <head> <title>CRUD AngularJS</title> </head> <body ng-controller="MainCtrl as ctrl">…
-
4
votes2
answers230
viewsA: How to convert a yaml to PHP array?
In the Manual for PHP, have an example: $yaml = <<<EOD Usuario: nome: Wallace idade: 25 linguagens: - PHP - Python - Javascript EOD; $parsed = yaml_parse($yaml); echo "<pre>";…
-
1
votes3
answers37
viewsA: Problem adding a date to an array index
Try this, I think you’ll find out where the problem is occurring: function formatDate($data) { return implode('-',array_reverse(explode("-", $data))); } $pcb_data = array(); while($r =…
-
1
votes1
answer1866
viewsA: PHP variable inside modal
First we take the library of Bootstrap, in this case I took the Cdns: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />…
-
0
votes6
answers650
viewsA: How to extract a variable from within a function
You will never be able to access the values externally for a Lambda Function, of the kind of jQuery that run everything internally, however, you can create a subfunction that has an external output…
-
1
votes1
answer350
viewsA: Records being inserted in two tables between Entities with (Doctrine - Foreign Key)
You can take the state entity this way: //coloque o caminho completo... 'Base\Model\...' $estadoEntity = $em->getRepository('\Clientes\Entity\Estado')->findOneBy( array( 'id' => 2 ) ); Or…
-
0
votes4
answers835
viewsA: Load page with Jquery event
I think you need something that way: $('.checks') .on('load, change',function() { var i=0; $("input.checks:checked").each(function(){ i++; }); if ( i > 0) { $('#abre').show(); } else {…
-
2
votes3
answers6114
viewsA: Display message after MYSQL query return empty
Just create a condition if the collection is empty: <?php require_once "conexao_sup.php"; if (isset($_POST['chave'])) { buscarDados($_POST['chave']); } else { //exibe mensagem se não tiver nada…
-
0
votes2
answers138
viewsA: Make jQuery-Tools Handle accompany a team
There is a lock for the execution of your script jquery.tools due to its output returning in an iframe, it becomes an element in HTML and not a js, I believe it is an easy problem to solve, treating…
-
2
votes4
answers258
viewsA: Doing level calculation and experience with Javascript
Well I don’t understand what the right concept is, but in theory, I think that’s what you need: <title>Calculadora de EXP</title><meta charset="utf-8"><style type="text/css">…
javascriptanswered Ivan Ferrer 12,096 -
1
votes1
answer956
viewsA: Google Maps showing all gray
I arranged for the map to be displayed, however, there is a problem in route, I do not know if they are correct, but you can look for more information here, I believe you are exceeding the limit of…
-
1
votes2
answers808
viewsA: Do not rotate iframe until clicking
In a very simple way, without needing the jquery, you can do this: function viewIframe(idIframe, idUrl) { var obj = document.getElementById(idIframe); var oLink = document.getElementById(idUrl); if…
-
0
votes3
answers566
viewsA: Call construction class
For that class Financeirocontroller is instantiated, it needs to receive 4 parameters in its constructor, the type that is induced is the name of the classes you need to use, one of them is…
-
1
votes4
answers2897
viewsA: Verifies which variable is with higher value returning the variable not the value
I don’t know exactly what you need it for, but you can do it: <?php $valor_01 = 6; $valor_02 = 4; $valor_03 = 3; $valor_04 = 9; $valor_05 = 8; $valor_06 = 5; echo '$'.max(explode(',…
phpanswered Ivan Ferrer 12,096 -
0
votes6
answers392
viewsA: How to make a explode without returning empty values?
You can use the array_diff(): $teste ='/a/b/c/d'; $saida = array_diff(explode('/', $teste), array('', null)); print_r($saida);
phpanswered Ivan Ferrer 12,096 -
1
votes2
answers114
viewsA: Insert Mysql PDO
The problem is that you were mixing the UPDATE structure with the insertion of the query: To Insert use: INSERT INTO TABELA (campo1, campo2) VALUES (:campo1, :campo2) For update use: UPDATE TABELA…
-
1
votes2
answers451
viewsA: Transforming Image into Base 64
I believe that by doing this, solve the problem of the black image: dataURL.replace(/^data:image\/(png|jpg|jpeg);base64,/, ""); var tb1 = '<img src=' + dataURL + '>';…
-
0
votes2
answers476
viewsA: Create "Slide" from image
That’s exactly what you need then: Example: http://www.tocadigital.com.br/biblioteca/galeria/ Download: http://www.tocadigital.com.br/biblioteca/galeria/galeria.zip Here the code: <!DOCTYPE…
-
2
votes3
answers15565
viewsA: Which regular expression can I use to remove double spaces in Javascript or PHP?
That way it already resolves: Javascript: var text = 'Estou no Stack Overflow em Português '; text = text.replace(/\s+/g, " "); PHP: $text = 'Estou no Stack Overflow em Português '; $text =…
-
2
votes5
answers444
viewsA: PHP array types and values
With "arrow" you are referencing the attribute of an object (Object), with brackets, you are referencing the key of the matrix (array). To switch the typing, you would have to force the typing or do…
-
1
votes2
answers335
viewsA: How to verify that the document markup is HTML5?
Whereas HTML5 documents are declared in the block early with: <!DOCTYPE html>, in addition to them there are the old versions as demonstrated at this address:…
-
0
votes4
answers1737
viewsA: How to use "wildcard" in "CLASS" selectors with jQuery.expr?
You can do it this way that also works: $(function() { $('div').each(function() { var classes = $(this).attr('class'); var arrClass = classes.split(' '); arrClass.forEach(function(value, key) { if (…
jqueryanswered Ivan Ferrer 12,096 -
1
votes2
answers162
viewsA: Delete selected input from an array with jquery condition
I haven’t tested it, but see if it works that way, only you have to keep the file name different: $(document).ready(function() { var btnremoveimg = $('.remover-img'); btnremoveimg.click(function() {…
-
0
votes4
answers549
viewsA: How to get user name in URL?
To simplify, I believe that doing so already solves the case: $value = trim($_SERVER['PATH_INFO'],'/'); There are other ways... a) Using parse_url(): $parse = parse_url($_SERVER['REQUEST_URI']);…
phpanswered Ivan Ferrer 12,096 -
9
votes12
answers28737
viewsA: What are the ways to iterate an array in PHP (without foreach)?
You can build a Patterns design interaction, as the example below, which is based on PHP Iterator ( http://php.net/manual/en/class.iterator.php ): <?php //entrada de elementos $myCollection = […
-
1
votes1
answer775
viewsA: How to make slide effect with jquery and js
The name of this effect is called Slideshow: As an example, it has the model of bootstrap. To work you need to insert the css file and the js of the version you want to use. Here’s a working model:…
-
1
votes3
answers187
viewsA: Omitting Else is a good idea in some cases, right?
I don’t mean to be annoying, but I can make it even better: $usuario = Usuario::find($id); //se for nulo, retorna 'false', caso contrário, retorna a mensagem $msg = (is_null($usuario)) ? false :…
-
1
votes3
answers487
viewsA: Problems between loop and ajax
In your case, you can do something much simpler than what you’re doing, and avoid so many unnecessary posts, something like: function soma(teste) { console.log(JSON.parse(teste)); } function…
-
1
votes5
answers1500
viewsA: Keep displaying the date and time in the javascript browser
If you just want a watch, you just make an exit of that kind: <body onload="init()"> <div id="count_label_ms"></div> <script> var init = function() { var interval =…
javascriptanswered Ivan Ferrer 12,096 -
0
votes2
answers4716
viewsA: How to force HTTP access (Unsafe)
Try changing these lines in your .htaccess: RewriteCond %{HTTP_HOST} ^dominio\.com$ [NC] RewriteRule ^(.*)$ http://www.dominio.com/$1 [L,R=301] To: RewriteCond %{SERVER_PORT} ^443$ [OR] RewriteCond…
-
0
votes2
answers142
viewsA: Error reading position (3) of Two-dimensional array: Invalid argument supplied for foreach
To get the values of your two-dimensional array, do the following: $content = []; foreach ($aArray as $title => $aInfo) { $content[]= "Titulo: ".$title; if (!empty($aInfo)) { foreach ($aInfo as…
-
0
votes1
answer273
viewsA: Save REQUESTS AJAX to be executed later
You can log your application, below an example of how to do this: $(function() { $('#submit_button').on('click', function() { var data = {teste: 'teste'}; $.ajax({ url: "send_data.php", data: data,…
-
6
votes6
answers10207
viewsA: Open Multiple Bootstrap Modals
Instead of you creating multiple modes, use only the data-target calling content into your modal data-target="#id_objeto" and pass the parameters or behavior via data-qualquercoisa: <div…
-
1
votes3
answers2115
viewsA: How to use setx() and setY() methods from the FPDF library.
This serves to define the positioning of the element you will make the output, works like a pointer, at each "set" it puts your pointer in the desired position: //posiciona verticalmente…
-
0
votes3
answers3409
viewsA: How to receive a POST without the <form> tags in PHP?
In Javascript you can send via post, with the jquery post method: <script src="//code.jquery.com/jquery-latest.js" type="text/javascript"></script> Putting the following script:…
-
1
votes2
answers1688
viewsA: Join a number of people without repeating the combination with the stipulated maximum
I did something similar, but to get only the available people without them having to confront each other in the same spot, I hope it helps you: http://ideone.com/KNYZYU…
-
2
votes4
answers4345
viewsA: Stop and restart setInterval function
To do this, you need to create a variable that transports between methods and always allows you to return the origins: var countms = 0; var intervalTxt = null; function start() { var id_label_ms =…
javascriptanswered Ivan Ferrer 12,096 -
0
votes3
answers652
viewsA: JSON for PHP via AJAX
You can create a button and post by storing the values in an array as shown below: $('.preview-add-button').click(function() { var itens = []; var form_data = {}; form_data["status"] =…
-
1
votes3
answers943
viewsA: How to sort DOM elements by jQuery?
You can do this way that will get the ordering you want: $(function() { var elems = $('ul').children('li').remove(); //ordena sua lista em ordem crescente elems.sort(function(a, b) { return…
jqueryanswered Ivan Ferrer 12,096 -
1
votes4
answers64762
viewsA: Mysql installation socket error
Well, I think I found the problem, and it was in a very simple way, as I found the problem, it might help others, so I decided to publish the answer: First I tried to remove the corrupted version:…
-
5
votes4
answers64762
viewsQ: Mysql installation socket error
I am unable to uninstall or make Mysql 5.5 work on my Ubuntu Linux 14.04.LTS, every time I try to access it, I get the following message: ERROR 2002 (HY000): Can’t connect to local Mysql server…
-
2
votes2
answers384
viewsA: Run callback on close android keyboard
You can try something like this: $scope.reportEvent = function (event) { if (event.type == 'doubletap') { $timeout(function () { if (window.cordova && window.cordova.plugins.Keyboard) {…
-
2
votes2
answers493
viewsA: Adding and removing elements in an array
If you want to, preserve the position, do it this way, hope it’s what you need: <html> <body onload="elementList();"> </body> <script> var elementos =…
-
0
votes3
answers115
viewsA: Multiple callbacks with Javascript
The problem may be a simple thing or a complex thing, but from what I’m seeing it seems you haven’t declared the variables out of function. I suggest you do something like this and see if you still…
-
1
votes1
answer1284
viewsA: Mysql search with select option filter
The problem is you put quotation mark in the name of the fields, and this causes you to make an invalid comparison. Fix as below that your query will work: if ($tipoentradalog) { $where[] = "…
-
0
votes1
answer281
viewsA: phpmailer sends email to myself
Try this way, because if the email is invalid the email will not be sent: $mail->SetFrom((filter_var($email, FILTER_VALIDATE_EMAIL) !== false) ? $email : '[email protected]' , (string) $nome);…
-
1
votes2
answers1307
viewsA: Use Angularjs to pass parameter to Jquery
Pass confirmFX into your controller, as in the example below: angularApp.controller('SetorController', ['$scope', '$routeParams', '$location', '$filter', '$http', 'confirmFx', function ($scope,…
-
1
votes2
answers138
viewsA: How do I take a data on one page and put it on another?
What you want seems very simple to me, you can do it this way: Create a class (file: Database.php) to access the database using PDO, as in the example below: class Database { private static…