Posts by Marcio Mazzucato • 537 points
14 posts
-
1
votes3
answers2408
viewsA: Cielo Integration By Page Store
I went through the same problem, in my case I decided renaming the SSL file that comes in the Cielo integration kit, because in the Curl definition you are using the format that comes in the example…
phpanswered Marcio Mazzucato 537 -
0
votes3
answers1927
viewsA: PHP: filter_input with REQUEST
You can try to use filter_input_array(). For example: $vars = array( 'key1' => FILTER_SANITIZE_NUMBER_INT ); $entradas = filter_input_array(INPUT_REQUEST, $vars); echo $entradas['key1']; Another…
-
4
votes2
answers1405
viewsA: How to send two values per parameter with a single option selected? PHP
An alternative is you do not specify the value, in this case the content of <option>, for example: <option> <?php echo $data->format("d/m/Y") . ' às 14:15'; ?> </option>…
-
1
votes1
answer139
viewsA: Picks up checkbox values
Maybe this error is happening because no option has been selected, try to use is_array() instead of Empty(). if (is_array($_POST['combustivel'])) { foreach($_POST['combustivel'] as $comb) { echo…
-
9
votes3
answers1170
viewsA: How do I count the amount of products per category?
A solution with good performance and readability can be obtained with the use of Count() and group by. SELECT c.id_categoria, c.nome_categoria, count(p.id_produto) AS quantidade FROM tbl_categorias…
-
2
votes1
answer61
viewsA: Get value from div
First of all, I advise you to refactor your code, logic is not cool. But in keeping with what you’ve already done, I believe that the way to achieve what you expect is by generating the function…
phpanswered Marcio Mazzucato 537 -
3
votes2
answers185
viewsA: Loop to repeat the previous keys (3, 32, 321, ...)
I believe that by accumulating the link in a variable you get the result you expect, for example: $breadcrumbs = array( array( 'Bairro' , 'bairro' ) , array( 'Rua' , 'rua' ) ); foreach (…
-
3
votes2
answers117
viewsA: Inheritance or Addiction?
Seeing on the side of cohesion and coupling, which is one of the key points of the Dependency injection, I’d rather make Curl a dependency on Marketplace, thus you will have a better cohesion, a low…
-
3
votes4
answers1666
viewsA: SQL Injection via url
Your code is totally vulnerable to SQL Injection, to prevent intrusions you can use two very useful resources, the input filters and the PDO for your query to be parameterized. Your code with the…
-
3
votes2
answers463
viewsA: How to compare an inserted sentence with existing ones in the comic returning the probability of being similar?
There is the function similar_text(), it calculates the similarity between two strings, for example: similar_text('Olá mundo', 'Oi Mundo', $percentualSimilaridade); echo 'Percentual de similaridade:…
-
0
votes1
answer172
viewsA: Select with JOIN to return an Object with Internal List
If you use: $Ps->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP); Will get: array(2) { ["joao"]=> array(2) { [0]=> string(8) "kkk-0000" [1]=> string(8) "jjj-0000" } ["paulo"]=> array(2)…
-
2
votes7
answers39327
viewsA: How to create input masks with Javascript?
For those who can use jQuery, there is the maskbrphone, it serves to mask phones with eight and nine digits using or not the DDD. The syntax is very simple, example: $('#telefone').maskbrphone()…
javascriptanswered Marcio Mazzucato 537 -
2
votes4
answers3211
viewsA: How to do strstr() in jquery
There’s a really cool project called php.js, there are Javascript implementations of the main functions of PHP, including the strstr(), it is possible to inform even the third parameter. Example of…
jqueryanswered Marcio Mazzucato 537 -
3
votes1
answer181
viewsA: Pick up values with jQuery
You can get by using the $.each: var soma = 0; $('.quantidade').each(function(index) { soma += parseInt($(this).val()); }); alert('Soma: ' + soma); I see you’re using the same ID quantidade for all…