Posts by Pedro Augusto • 2,392 points
126 posts
-
0
votes1
answer260
viewsA: Apply mask when typing in input field, when typing a number show asterisk instead of numbers or letters
I found this answer in SOEN (https://stackoverflow.com/questions/45113132/partial-password-masking-on-input-field). You can adapt your reality, it practically does what you want. var ssn =…
-
2
votes1
answer140
viewsA: Edit mysql ini in container
Apparently when defining the version to use mysql, and not leaving the latest, solved my problem. In the yml below note that I set the mysql version to 5.6. To break the restart: always to…
-
3
votes1
answer140
viewsQ: Edit mysql ini in container
I’m using Docker to generate a LAMP. Man yml is like this: web: image: tutum/apache-php ports: - "80:80" links: - db volumes: - $PWD:/app db: image: mysql environment: - MYSQL_ROOT_PASSWORD=…
-
2
votes4
answers717
viewsA: In a sentence, how to know which word has the least characters?
I found this answer in the SOEN: function findShortestWord(str) { var words = str.split(' '); var shortest = words.reduce((shortestWord, currentWord) => { return currentWord.length <…
-
1
votes1
answer92
viewsA: Print table data
Put a while to receive all records from the database. echo "<table>"; $sql = mysqli_query($strcon, "SELECT * FROM cadastro"); while($exibe = mysqli_fetch_row($sql)){ echo…
-
0
votes1
answer39
viewsA: Sent POST text "<td>" via AJAX
Assuming your foreach has a column id, try like this: <?php foreach ($resultado as $row) { ?> <tr> <td class="seis_<?=$row['id']?>"><?php echo $row['seis'];…
-
0
votes1
answer265
viewsQ: Delete Mysql data
I have a table with a large amount of data (380 million). I need to erase the old data that is no longer useful in the system. I am generating backup for precaution. What’s the best way to erase?…
mysqlasked Pedro Augusto 2,392 -
1
votes2
answers161
viewsA: Resize two Divs at the same time with jquery-ui
Edited with the AP context I found a related question in the O.R., this here. $("#div1").resizable(); $('#div1').resize(function(){ $('#div2').height($(".container").height()-$("#div1").height());…
jquery-uianswered Pedro Augusto 2,392 -
2
votes4
answers9972
viewsA: How to get the month and current year in SQL?
Script to return a full date. SET LANGUAGE Português SELECT DATENAME(weekday, GetDate()) + ', ' + DATENAME(day, GetDate()) + ' de ' + DATENAME(month, GetDate()) + ' de ' + DATENAME(year, GetDate())…
-
2
votes1
answer218
viewsA: Two on-change in a select
You can call two functions like that: <select class="form-control" formControlName="tipoped" on-change="PesquisaPrazo('prazo', this.digitacaoForm); PegarCfop(this.digitacaoForm);" id="q3Id">…
-
0
votes2
answers281
viewsA: Place animation in the Hide of a div
Use the function toggle jquery. She alternates between hide and show the referenced element. <button type="button" class="btn btn-success" id="botao-acao">Esconder/Mostrar DIV</button>…
-
-1
votes2
answers80
viewsA: How to use copy()?
According to manual <?php $file = 'example.txt'; $newfile = 'example.txt.bak'; if (!copy($file, $newfile)) { echo "falha ao copiar $file...\n"; } ?> Where: $fileis the source file and $newfile…
phpanswered Pedro Augusto 2,392 -
2
votes1
answer193
viewsQ: Consult real-time database inserts
There is a table in Mysql that suffers many insertions. The application needs to show these changes to the customer. Currently the existing application query, every 10 seconds, the table and shows…
-
1
votes1
answer457
viewsA: AJAX function to update table
Try this: success: function (data) { var trHTML = ''; $.each(data, function (i, item) { trHTML += '<tr><td>' + item.id+ '</td><td>' + item.fornecedorProduto+…
-
1
votes1
answer23
viewsA: Information is off the table in while
Right wouldn’t be like this? <?php } }else { $sqle = mysqli_query($conn, "SELECT * FROM jsondados WHERE empresa='cnet' "); $numRegistross = mysqli_num_rows($sqle); if ($numRegistross != 0) {…
-
2
votes1
answer83
viewsA: How to save an array to separate lines in DB
First we will correct your form: <form action="/action_page.php" method="POST" id="usrform"> Escola: <input type="text" name="escola"> Turma: <input type="text" name="turma">…
-
3
votes2
answers541
viewsQ: Mount INSERT from SELECT
I’d like to make a select and from it to generate the insert. I want to start from the prepost that I don’t know the table structure, the number of columns, nothing but the table name. select * from…
-
1
votes1
answer2413
viewsQ: Copy records from one table to another via select
I am copying the records from one table to another in different databases, but a column in the new table cannot be null and the data coming from the old table are null. Is there a way to put some…
-
-1
votes1
answer407
viewsA: ignore caching on a given page . php
In a short version: Using PHP: header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1. header("Pragma: no-cache"); // HTTP 1.0. header("Expires: 0"); // Proxies. Using HTML:…
-
0
votes2
answers1127
viewsA: Woocommerce Product Registration outside the Wordpress dashboard
Woocomerce has a REST API that can handle all functions and attributes of the entire tool. Below is how to register a PHP product using the woocomerce REST API. <?php $data = [ 'name' =>…
-
0
votes2
answers9463
viewsA: Mysql query error - Warning: mysqli_fetch_array() expects Parameter 1 to be mysqli_result, Object Given in
The structure for mysql queries in php is as follows: <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) {…
-
4
votes1
answer59
viewsA: Error in IF condition
Note that you are not using the comparator but assigning the value to the variable: if( $user_info['nome'] = 'Tiago Gonçalves') The right thing would be: if( $user_info['nome'] == 'Tiago Gonçalves')…
-
1
votes0
answers36
viewsQ: Show errors on screen
How to show all php errors in the browser? If for example give erro 500, how to show on the web page why of it ? My question came because I don’t have access to the error log generated by the…
phpasked Pedro Augusto 2,392 -
1
votes2
answers68
viewsQ: Increment in For loop
I need a count that goes from 1 to 24, but in that order: 1,9,17,2,10,18,3,11,19,4,12,20,5,13,21,6,14,22,7,15,23,8,16,24 I did so, but I wanted something more "elegant". for($x=1;$x<9;$x++){ echo…
-
1
votes0
answers77
viewsQ: Convert Multiple HTML pages to PDF
I am converting html to pdf using html2pdf. But with the increase in the number of pages this conversion takes a long time. In my case 24 pages is more than 15 minutes. Any suggestions on how to…
phpasked Pedro Augusto 2,392 -
3
votes1
answer1060
viewsQ: Select Float Mysql
In a field mysql is stored 104.13 format Float; With this select, I can see the record: SELECT * FROM parcelas WHERE valor like '104%'; But with this select does not appear: SELECT * FROM parcelas…
mysqlasked Pedro Augusto 2,392 -
0
votes2
answers847
viewsA: Format phones in mysql table
I use the following query to format my numbers. But mine are stored without the 55. You can adapt your reality: select numero, concat('(',substr(numero_cleansed,1,2),')…
-
0
votes1
answer99
viewsQ: Replace Mysql with substring
I have information saved in a mysql field with the following format: STRING STRING STRING XXX Separating these strings there are 4 spaces. I would like to remove everything that is after these 4…
mysqlasked Pedro Augusto 2,392 -
1
votes3
answers5235
viewsA: pass 2 parameters in button Onclick event
<button type="button" id="button" class="btn btn-secondary adicionar_empreendedor" data-dismiss="modal">Confirmar</button> <script>…
-
2
votes4
answers23448
viewsA: Vehicle consultation by the Board on the site sinesp via PHP - without captcha
Working according to Github: https://github.com/chapeupreto/sinesp All credit to the creator of this code, I’m just passing along. Installation: composer require chapeupreto/sinesp Utilizing:…
phpanswered Pedro Augusto 2,392 -
2
votes2
answers40
viewsA: Send array to PHP via Ajax
Your javascript should look like this: var info = []; info[0] = 'thiago'; info[1] = 'carlos'; $.ajax({ type: "GET", data: {info:info}, url: "buscar.php", dataType: "json", success: function(msg){…
-
1
votes1
answer995
viewsA: How to use If with Insert in Mysql?
I don’t know if it’s the ideal solution. I don’t know if it’s the right way either. But for the title of curiosity and study (for me and for everyone), take a look at this Function. DELIMITER //…
mysqlanswered Pedro Augusto 2,392 -
2
votes2
answers47
viewsA: Catch date previous to year 2000 Mysql
SELECT nome_funcionario FROM funcionario WHERE data_contratacao < '2000-01-01'
mysqlanswered Pedro Augusto 2,392 -
0
votes1
answer62
viewsA: Readonly Toggle
[RESOLVED] $("#form:input").each( function() { $(this).prop("readOnly",!$(this).prop("readOnly")); });
jqueryanswered Pedro Augusto 2,392 -
0
votes1
answer62
viewsQ: Readonly Toggle
All fields of a form come with readonly. I use the function below to remove the attribute from all inputs. $('#form input').attr('readonly', false); But I would like to do something similar to…
jqueryasked Pedro Augusto 2,392 -
5
votes1
answer9357
viewsQ: Run JNLP Ubuntu
My current version of java is as follows: openjdk version "1.8.0_131" OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11) OpenJDK 64-Bit Server VM (build 25.131-b11, mixed…
-
0
votes2
answers45
viewsQ: A separate city sql query
My Brand Sales Chart: City for which the sale was made, date and time of sale. I would like to pull all sales sorted by date and time, but with a specific separate city. For example: For sale 12 -…
-
0
votes4
answers66
viewsA: Help with PHP and Mysql
select clicks from links where link = "http://www.gmail.com"; $clicks= explode(",",$row->clicks); for($x=0;$x<count($clicks);$x++){ $sql = "select nome, email from users where id =…
-
1
votes2
answers81
viewsA: How do I pass this function to a php file called Geolocation via ajax?
I use the following script to take geolocation every 20 seconds and send it to a PHP page to record to the database. It may not be exactly what you want, but it’s a starting point. Create the file…
-
0
votes1
answer108
viewsA: Nav-pills open to left
RESOLVED I added the following style to the tag <ul> <ul class="dropdown-menu" style="right: 0; left: auto;">
-
0
votes1
answer108
viewsQ: Nav-pills open to left
I’m following the following code: <ul class="nav nav-pills"> ... <li role="presentation" class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"…
-
0
votes0
answers86
viewsQ: Input file type open when loading page
I have the following input: <input type="file" accept="image/*" capture="camera" style="display:none" id="capturar"> I would like when loading the page to already open the field to select the…
-
3
votes1
answer1181
viewsQ: Table size does not decrease
A mysql table had 10.2Gb of data, I ran a script that deleted old data that was no longer needed, After erasing half of the data from this table, it still continues with 10.2Gb. Consuming my server…
mysqlasked Pedro Augusto 2,392 -
0
votes1
answer76
viewsQ: How to consult abbreviated words or not without differentiating them, as STREET and R.?
User inserts as search "STREET STOP". But in the Mysql database you may be saved as "R. Do Stop" or only "STOP". How to optimize this search to get the best result, or the closest ?…
mysqlasked Pedro Augusto 2,392 -
4
votes3
answers434
viewsA: Error converting php data
If you are receiving the mysql date and want to convert to Brazilian format use the following command: $data = implode("/", array_reverse(explode("-", $data))); This will create the mysql date in…
-
2
votes4
answers23448
viewsA: Vehicle consultation by the Board on the site sinesp via PHP - without captcha
Solved and running again. Explained step by step: https://github.com/victor-torres/sinesp-client SINESP Client SINESP Client makes it possible to consult the SINESP Citizen database without the need…
phpanswered Pedro Augusto 2,392 -
1
votes1
answer130
viewsQ: Subtract Datetime variables
I have two datetime fields and would like to know the difference between them. I am developing in Php Gtk, so the functions have to be as low as possible.
phpasked Pedro Augusto 2,392 -
1
votes1
answer3637
viewsA: Check empty fields with php
You can check field by field with the function empty() and is_null() or compare value with empty. But all at once does not give. I found this piece of code that might make it easier for you, I…
phpanswered Pedro Augusto 2,392 -
2
votes2
answers6059
viewsA: Create executable program with php, html and mysql
Using PHP as Desktop Software is not the best option. But you have two ways to do it. With the PHPDESKTOP and with the PHP-GTK. I am not an expert on desktop languages, but they will certainly…
phpanswered Pedro Augusto 2,392 -
-1
votes3
answers918
viewsA: How to do multiple Inserts at once?
Apparently the error you’re making is that you’re trying to insert duplicate values into a unique value field. But to insert multiple values with an Insert just do so: INSERT INTO `usuarios` (`id`,…