Posts by Pedro Augusto • 2,392 points
126 posts
-
0
votes0
answers12
viewsQ: Get html and scripts
Has an options panel that changes constantly. I display it in a sweetalert that way: $(document).on('click','#acoes',function(){ $.get('acoes.html', function(data) { Swal.fire({html: data}); }); });…
jqueryasked Pedro Augusto 2,392 -
0
votes0
answers18
viewsQ: Scroll with wrap-Reverse css
I have the following structure. .sideBar{ padding: 0 !important; margin: 0 !important; background-color: #fff; overflow-y: auto; border: 1px solid #f7f7f7; height: 100px; display: flex; flex-wrap:…
cssasked Pedro Augusto 2,392 -
0
votes3
answers98
viewsA: Create combinations with a specific quantity in a given set of numbers
You can use the function array_rand to do this $qtd = 5; $input = array(1,2,3,4,5,6,7,8,9,10,11,12); $rand_keys = array_rand($input, $qtd); for($x=0;$x<$qtd;$x++){ echo $input[$rand_keys[$x]] .…
-
1
votes1
answer19
viewsA: Fetching array Mysql
Before the mysqli_fetch_array you should run your sql with the mysqli_query. Passing your connection to the database as a parameter. $c_email = $_SESSION['customer_email']; $sql = "SELECT * FROM…
mysqlanswered Pedro Augusto 2,392 -
1
votes1
answer48
viewsA: Checkbox list selects only the first option not allowing selecting the others
The problem is that all labels are referencing the same id. Try it like this: <div class="custom-control custom-switch"> <input type="checkbox" class="custom-control-input" id="<?=…
-
5
votes3
answers123
viewsQ: Compare range of values
The code below compares a value and according to this value generates a percentage and works. But I would like a more practical way, whether function or other structure, because these ranges of…
-
0
votes1
answer51
viewsA: Show in select database results
Use the mysqli_fetch_object direct to display the results in object format. Serviço: <br> <select name='servico' id='servico'> <option>Selecionar Serviço</option> <?php…
-
2
votes1
answer192
viewsQ: Group by age range
I would like to tabulate customers registered in a database mysql by age range. I have a field nascimento guy date. With the consultation below I can group by birth. SELECT COUNT(*) AS qtd,…
mysqlasked Pedro Augusto 2,392 -
0
votes3
answers69
viewsQ: Select by varchar position
I have in mysql database a field documento of the kind varchar. Records follow the following pattern: 123456789,12X456789. Or all in numbers or containing a letter in the third position. How do I…
mysqlasked Pedro Augusto 2,392 -
1
votes1
answer247
viewsQ: Styling Html5 datepicker
I know it’s possible to style input date of html5. ::-webkit-datetime-edit { padding: 1em; } ::-webkit-datetime-edit-fields-wrapper { background: silver; } ::-webkit-datetime-edit-text { color: red;…
-
1
votes1
answer442
viewsQ: Insert Html into Html without changing Styles
I am capturing emails to be shown on screen, in html. But my page has some styles already applied, so I include html extracted from the email body. The styles present in this html change the one on…
-
0
votes1
answer53
viewsA: Rotate image and resize to fit
I found two interesting answers on this topic: https://stackoverflow.com/questions/18531698/css-rotate-image-and-align-top-left function rotateImage(elm, deg) { $(elm).css('margin-left',…
-
0
votes1
answer53
viewsQ: Rotate image and resize to fit
I have the following script var graus = 0; $(document).on('click','img',function(){ graus = (graus+90); if(graus>350) graus = 0 $(this).css({ "-webkit-transform": "rotate("+graus+"deg)",…
-
1
votes0
answers30
viewsQ: Changing the orientation of the screen
My PWA website has the following guideline on manifest.json: "display": "standalone", "orientation": "portrait" Thus ensuring that it is viewed in full screen and always in portrait orientation. A…
-
0
votes2
answers90
viewsQ: Changing title of div
I would like to dynamically change via jQuery the title of a div. I have the code below, but it doesn’t work. It does the post, returns the correct value. However, with the mouse on top of the div…
jqueryasked Pedro Augusto 2,392 -
0
votes1
answer97
viewsQ: Divs with zebra colors and property order
I have the following structure: .pai{ width: 300px; display: flex; flex-wrap: wrap; } .filho{ width: 80%; margin-top: -1px; border: 1px solid black; } .ordem1{order:1} .ordem2{order:2}…
cssasked Pedro Augusto 2,392 -
0
votes1
answer86
viewsQ: Page change "Onclick" always "invalid views to Insert"
I would like you to click a button, change page. I’m in inicio and would like to go to add-oferta. top html. <ion-fab bottom right > <button ion-fab color="secondary"…
-
0
votes1
answer67
viewsQ: Sort by two date fields
I have the following structure: ID | PROMESSA | VENCIMENTO 1 | 2019-01-04 | 2019-10-08 2 | 2019-01-03 | 2019-10-07 3 | 2019-01-02 | 2019-10-06 4 | NULL | 2019-10-05 5 | NULL | 2019-10-04 6 | NULL |…
mysqlasked Pedro Augusto 2,392 -
0
votes1
answer171
viewsQ: Multiple php functions at the same time
I have a script that contains numerous functions. All independent of each other. It is taking considerable time to perform all functions. Is there a way to perform several functions without waiting…
phpasked Pedro Augusto 2,392 -
4
votes1
answer121
viewsA: How to add comma quotes to a variable that comes in array?
Assuming the values are only between 0 and 9. First separate each character from the original string, using str_split. Then join all the parts with a "glue" you want, using implode <?php $texto =…
phpanswered Pedro Augusto 2,392 -
2
votes1
answer97
viewsA: Include registration and return disabled button without refresh
First put a class on the button to identify you to the javascript: <a class="btn btn-primary botao-adicionar-amigo" amigo_id="<?php echo $id; ?>">Adicionar amigo</a> Now use that…
-
2
votes1
answer309
viewsA: Mysql update only one line field
Try it like this: UPDATE fotos SET FOTO1 = IF(FOTO1='aaa.jpg', NULL, FOTO1), FOTO2 = IF(FOTO2='aaa.jpg', NULL, FOTO2), FOTO3 = IF(FOTO3='aaa.jpg', NULL, FOTO3), WHERE 'aaa.jpg' IN (FOTO1 , FOTO2,…
-
-1
votes3
answers228
viewsA: How to move a cursor as user type?
I found this solution by taking a look at the SOEN. See if it suits your scenario. $(function() { var cursor; $('#cmd').click(function() { $('input').focus(); cursor = window.setInterval(function()…
-
0
votes1
answer222
viewsQ: Curl with false answer
I’m integrating Zenvia to text a system. I use the script below, second documentation. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api-rest.zenvia.com/services/send-sms");…
phpasked Pedro Augusto 2,392 -
2
votes1
answer308
viewsA: how to put a domain checker in php?
You can use checkdnsrr or gethostbyname: Documentation: http://www.php.net/checkdnsrr http://www.php.net/gethostbyname Example of checkdnsrr: <?php if ( checkdnsrr('example.com.', 'ANY') ) { echo…
phpanswered Pedro Augusto 2,392 -
3
votes2
answers51
viewsA: doubts in the elaboration of code
Use the mysqli_num_rows() to check the number of rows returned in the query mysql: http://php.net/manual/en/mysqli-result.num-rows.php To not let the user submit an empty query and thus bring the…
-
1
votes1
answer28
viewsQ: Align Divs according to class
I have a div father with several divs son inside. And I would like the Divs with the blue class to be on the right and the white class to be on the left. But next to each other, as in a row. Setting…
cssasked Pedro Augusto 2,392 -
2
votes2
answers343
viewsQ: Sql for plot counting
I have a billing chart. The significant fields are as follows: | vencimento | data_pagamento | valor_pago | I need to make an appointment to call me back: The number of unpaid arrears; The number of…
mysqlasked Pedro Augusto 2,392 -
0
votes2
answers320
viewsA: How you use the keyup in a specific input
Use id to select specific input. $( "#target" ).keyup(function() { alert( "Função .keyup() chamada." ); }); <script…
-
1
votes1
answer102
viewsA: PHP validate password
The expression below encompasses at least one minuscule letter, uppercase, number and symbol. with a size of 8+ chars:…
-
1
votes1
answer53
viewsA: Grab an HTML color As per IMAGE
Here’s exactly what you want in PHP: https://github.com/thephpleague/color-extractor Example: require 'vendor/autoload.php'; use League\ColorExtractor\Client as ColorExtractor; $client = new…
-
0
votes1
answer46
viewsQ: Join show later dates only
I have a table that records steps of a drive. For example: Data - Movimentacao - Produto 2018-01-10 - produzido - id1 2018-01-11 - embalado - id1 2018-01-12 - despachado - id1 2018-01-10 - produzido…
-
3
votes1
answer48
viewsQ: Sorting multiple columns
The sales table has the following structure: id_venda | nome_cliente | data_venda | data_agendamento | data_cancelamento | data_ligacao Where the "date" fields are all datetime. I would like to…
-
1
votes1
answer225
viewsA: Save email to SENT, IMAP folder
Wondering if the folder really is called Sent. I used IMAP to list the folders and found that the folder is called INBOX.Sent. I used the code below to list the folders: $mailbox =…
-
0
votes1
answer225
viewsQ: Save email to SENT, IMAP folder
I am trying to save the emails sent by Phpmailer in the "Sent" folder, so that those who access the email see what was sent by the system. I can save to the folder Inbox with the following code:…
-
2
votes2
answers50
viewsQ: Travel consultation
I have a table that records steps of a drive. For example: Date - Movement - Product 2018-30-10 - produced - id1 2018-30-11 - packed - id1 2018-30-12- dispatched - id1 2018-30-10 - produced - id2…
mysqlasked Pedro Augusto 2,392 -
3
votes1
answer155
viewsA: How to check if the Sliding puzzle is solvable?
The determining formula for verifying solvability is related to Parity of a permutation or in English Parity of a permutation. Which briefly calculates the amount of inversions needed to order a…
-
1
votes1
answer546
viewsA: Detect browser lock or tab
Use the event .unload(). https://api.jquery.com/unload/ Jquery < 3.0 $(window).unload(function() { alert("call"); console.log("this will be triggered"); }); Jquery >= 1.7…
-
3
votes2
answers29
viewsA: Jquery - Tooggle Panels
ids are unique identifiers. You are using the same for both Ivs. Try to put as class the Ivs, this will work. Or follow what I’ve done below. <!DOCTYPE html> <html> <head>…
-
1
votes1
answer57
viewsA: Install driver Mongo in apache+php container
I was able to install using the following commands: apt-get update apt-get install openssl libssl-dev libcurl4-openssl-dev pecl install mongo echo "extension=mongo.so" >…
-
1
votes2
answers27
viewsA: Get an item from each Row
Only use SQL SELECT DISTINCT Statement SELECT distinct(TESTEROWS) FROM COLUNA
-
0
votes2
answers96
viewsA: Remove array elements that are not in 2 PHP arrays
If your vectors are not objects you can use the array_intersect which calculates the intersection between arrays. Returns an array containing all values of array1 which are present in the other…
phpanswered Pedro Augusto 2,392 -
1
votes2
answers665
viewsA: How to add percentage to a PHP value?
You can do it like this: $valor *= (1+$percentual/100); $data->sell *= (1+30/100); //30% de acréscimo Or so. $valor_acrescido = (($data->sell*30)/100)+$data->sell;…
-
1
votes1
answer45
viewsA: How can I scroll to a specific location on the page using jquery?
Try this: $("#botao").on('click',function() { $('html, body').animate({ 'scrollTop' : $("#div_para_scrollar").position().top }); });
-
2
votes1
answer62
viewsA: What is@in php for?
It suppresses error messages. See in Operators of error control Example: <?php /* Erro de arquivo intencional */ $my_file = @file ('arquivo_nao_existente') or die ("Falha abrindo arquivo:…
phpanswered Pedro Augusto 2,392 -
2
votes3
answers738
viewsA: What is the $() [dollar sign followed by parentheses] for in BASH?
Very similar to crase ``. Is called command substitution (Posix Specification) and executes the command in a subshell. The command between the $() or crase (``) is executed in a subshell and the…
bashanswered Pedro Augusto 2,392 -
0
votes1
answer28
viewsQ: Add open plots with Join
I have two tables, Cliente and Parcela. The table Parcela owns the id do cliente as foreign key, a column pagamento that is null or contains the payment date in format date and a column valor that…
-
0
votes1
answer57
viewsQ: Install driver Mongo in apache+php container
I rode a container in accordance with the yml down below: web: container_name: "apache" image: tutum/apache-php ports: - "80:80" volumes: - /home/administrador/public_html:/var/www/html restart:…
-
0
votes0
answers710
viewsQ: Select on one server, Insert on another
I use the following query to select data from one database and insert into another: insert into banco_novo.cliente (codcliente, nome, cpf, rg, sexo, data_nascimento, endereco, bairro, cidade,…
mysqlasked Pedro Augusto 2,392 -
0
votes1
answer332
viewsA: Posts automaticas instagram php
You can use this API: https://github.com/mgp25/Instagram-API Here’s an example of how to upload a photo to Instagram: <?php require '../src/Instagram.php'; /////// CONFIG /////// $username = '';…