Posts by Bia • 2,016 points
60 posts
-
1
votes2
answers1541
viewsQ: Regex filter only values in real
I have the following regex: preg_match_all('/([0-9]+[\.]*[0-9]*[\,.]*[0-9]*)/', $string, $matches) If I get a string: 1 - João da Silva number 123456 with the value of R$:6,298.65 I have as return:…
-
0
votes1
answer92
viewsQ: Concatenate Lines with the same User
I have the following consultation: SELECT e.id_taxe, u.nm_user, dt_taxe, SUM(e.vl_taxe) as vl_taxe FROM taxe as e INNER JOIN user as u ON u.id_user = e.id_user WHERE id_enterprise = 86 AND (dt_taxe…
-
1
votes1
answer143
viewsQ: Select with subquery
I have the following select: SELECT id_usuario, SUM(CASE p.tp_honorario WHEN 'Mensal' THEN (h.vl_honorario * 12) ELSE h.vl_honorario END) as valor FROM empresa_honorario as h INNER JOIN honorario as…
-
2
votes2
answers82
viewsQ: Join bringing wrong value
I have two tables Enterprise: id_empresa id_usuario vl_honorario dt_honorario id_honorario 86 1 200 2017-01-04 7 86 1 600 2016-12-01 6 86 1 500 2016-11-01 5 86 212 300 2016-12-01 5 Honorary:…
-
2
votes2
answers3522
viewsA: Enable field when radio is selected
You can do this using Jquery: $(document).ready(function() { $("input[name='optionsRadiosInline[]'").on('click', function() { if ($("#radio_1").prop("checked", true)) {…
javascriptanswered Bia 2,016 -
4
votes2
answers2725
viewsA: How can I check if a table is empty?
Select and check the total number of lines: $select = mysql_query("SELECT id FROM tabela LIMIT 1"); if(empty(mysql_num_rows($select))) { echo "Tabela está vazia"; } else {…
-
7
votes1
answer489
viewsQ: Compare COUNT from two tables
I have two tables and I must return the total of the table with more data, I am doing so: SELECT CASE WHEN ((select count(*) as `familiar` from tb.familiar)) > ((select count(*) as `personal`…
-
1
votes3
answers4103
viewsA: Put a url inside select option
Do it this way: <select id="link"> <option value="" selected>Escolha o site</option> <option value="http://www.google.com">Google</option> <option…
-
0
votes2
answers139
viewsA: Problem Code UPDATE MYSQL PHP
Put sql like this: $query = "UPDATE player SET paymoney='10000' WHERE name = ".$name;
-
1
votes2
answers60
viewsA: Insert Rows at the top of the table
To catch the last 10: SELECT * FROM `table` ORDER BY id DESC LIMIT 10 To display all lines: $sql = "SELECT id,nome FROM `table` ORDER BY id DESC LIMIT 10"; $result = mysql_query($sql, $connection)…
-
1
votes4
answers1661
viewsA: Redeem name and show in option through id
<?php $id = 1; $sql = "SELECT nome FROM table WHERE id= '.$id.'"; $result = mysql_query($sql, $connection) or die (mysql_error()); $row = mysql_fetch_array($result);…
-
9
votes1
answer508
viewsQ: Convert date MMMM-YYYY to dd/mm/yyyy datepicker bootstrap
I have the following date field: <div class='input-group date input-data' id='datetimepicker4'> <input type='text' name="mes" id="mes" class="form-control hidden" /> <span…
-
2
votes1
answer201
viewsA: Include takes wrong url path
The solution found was to pass the absolute path to include in the following way: include $_SERVER["DOCUMENT_ROOT"].'/medic/views/_template/_layout.html'; For links, the ideal would be to use the…
-
3
votes1
answer201
viewsQ: Include takes wrong url path
I have the following structure: I would like the file, inside views/usuarios/usuarios-view.php, include the file _layout.html who stands in the way: views/_template/_layout.html, I’m doing so in the…
-
4
votes1
answer2544
viewsQ: Select last JOIN record
I have a table tb_processos and another tb_detalhes (saves details of a particular process), would like to take all the data of the process and only the last detail of the process. The way I’m doing…
-
1
votes2
answers619
viewsQ: Pass array to Modal
I have the following array $detalhes: Array ( [0] => Array ( [dt_detalhes] => 2016-03-09 [desc_detalhes] => Viabilidade [tp_processo] => Viabilidade [vl_protocolo] => 1234 ) [1] =>…
-
6
votes2
answers2640
viewsQ: Sum days on input date
I have a input date type, I would like to add to it 7 days and put this value in another input also date type, I tried to do so: <script> $('#txtSolicitacao').on('blur', function(){ data =…
-
1
votes1
answer53
viewsA: Show DIV by an ID
On the page envia.php, after sending the email correctly create a session: /*----- Função PHPMailer ------*/ $enviado = $mail->Send(); if ($enviado) { $_SESSION['EmailEnviado']=1; /*Caso o e-mail…
-
1
votes2
answers808
viewsA: Take the names of a form on a php page and put it in a select list on another php page
How you are using mysql (I advise you to study about mysqli or PDO), first select from the table cadastrar_loja on the page cadastrar_documento.php: $consulta = mysql_query("SELECT id,nome FROM…
-
4
votes1
answer1024
viewsA: Running time of youtube video
I was able to solve using the google API, which shows the time if the user gives play, pause or if the video ends: <script type="text/javascript"…
-
3
votes1
answer1024
viewsQ: Running time of youtube video
I’ve been searching and I haven’t found anything concrete, I know there’s a youtube API but I haven’t found any right source. How can I check on php whether or not the user watched a Youtube video…
-
3
votes2
answers1015
viewsQ: Horizontal scroll bar does not appear when using datatable
I have a screen where the data is shown in the following form: When accessing on smaller screens (cell phones, tablets), the datatable appears cut, however the horizontal scroll bar does not appear,…
-
5
votes1
answer5487
viewsQ: Modal occupy full screen
I have the following Modal and I want it to occupy the whole screen / or most of the screen: <div class="modal fade" id="treinamentos" tabindex="-1" role="dialog" aria-labelledby="alterarLabel"…
-
3
votes4
answers498
viewsQ: Full byte type cast
I have the following code: public class Principal { public static void main(String[] args){ int i = 10; byte b = 5; b = (byte)i; b += i; i = b; System.out.println( i ); } } I know the value returned…
-
5
votes1
answer186
viewsQ: Perform random SELECT
I have a table where I always want to show a single record randomly. I’m doing like this: SELECT `id` FROM `tabela` ORDER BY RAND() LIMIT 1 I see that in this way the same records repeat a lot,…
-
0
votes2
answers64
viewsA: SELECT returning data not seen by a particular user
Have you ever tried anything like: SELECT videos.video_id FROM videos JOIN video_visualizacoes ON videos.conta_id <> video_visualizacoes.conta_id ORDER BY videos.video_id DESC…
-
2
votes2
answers90
viewsA: How do I upload the image and delete the old one?
In that case, go through POST the old and new image: $image = $_POST['nova']; $image_old = $_POST['old']; /* Faça upload da nova imagem normalmente */ $clear = unlink($image_old); // apaga imagem…
-
0
votes3
answers8281
viewsA: How to delete structure and data from mysql database
Delete all tables from the database: SELECT concat('DROP TABLE IF EXISTS ', TABLE_NAME, ';') FROM information_schema.TABLES;
-
0
votes2
answers1051
viewsQ: Pass video url into Modal - Jquery
I’m passing the url into the embed (#meuid) thus: <script> $('#treinamentos').on('show.bs.modal', function (event) { var button = $(event.relatedTarget) var nome = button.data('nome') var…
-
5
votes4
answers16259
viewsA: How to use Progressbar with Ajax and PHP?
Example where the percentage accompanies the file upload: Necessary to include these files: <script src="../Content/js/jquery.min.js"></script> <script…
-
2
votes2
answers507
viewsA: mysql errors being displayed in French
Click the Wamp icon, then click Mysql and click my.ini Open this file with the notepad, give it a CTRL+F and look for: lc-messages=fr_FR Comment on this line with # and replace with:…
-
1
votes4
answers11464
viewsA: Increase image when user click on JS
Example using Javascript: <script language="JavaScript"> window.onload = function(){ var entidade = document.getElementById('imagem'); // Altere o número para a apliação/redução desejada var…
-
1
votes1
answer28
viewsQ: Redistribute query results in a two-dimensional array
I have the following query in the comic, which returns me three information: name, place, total list ($usuarios,$linha,$total) = buscarTopController(); do{ echo $linha['nome']; echo $linha['local'];…
-
3
votes1
answer4727
viewsQ: Select the 3 highest values
I have a table that has the following data: id_indication, id_user,lg_client A user can indicate multiple clients (lg_client = 1), would like a select that searches for the 3 users that indicated…
-
1
votes2
answers125
viewsA: Add product value to purchase
A functional example, it’s up to you to adapt to your case: Select pulling all companies from the bank, call an event on onchange that will fill in the inputs according to the values searched in the…
-
3
votes4
answers1844
viewsA: Generate new name for image during upload - php
You can use it UNIX TIMESTAMP // Define o novo nome do arquivo usando um UNIX TIMESTAMP $nome = time() . '.' . $extensao; To catch the extension use: $extensao= $_FILES['uploadfile']['type'];…
-
2
votes3
answers38959
viewsQ: How to position text within an image
I have the following picture and text TEST, would like to position the word TEST where is the X in the image. <img src="../Content/Images/top.png"> <label>TESTE</label> What’s the…
-
16
votes2
answers40895
viewsA: Validate input to only receive numbers with jquery?
This script accepts only numbers and "." : <script> function somenteNumeros(num) { var er = /[^0-9.]/; er.lastIndex = 0; var campo = num; if (er.test(campo.value)) { campo.value = ""; } }…
-
2
votes3
answers447
viewsA: Divide a date into two parts
The best way would be to use datatime To pick up the dates and times separately use: $datetime = '2010-07-05 12:11:00'; list( $date, $time ) = explode( ' ', $datetime ); echo 'Data: '.$date; echo…
-
12
votes3
answers14607
viewsA: How to identify which city the user is in?
Use Geoip, it does not give the exact location of the city, but approximate region of your access point through the user’s IP. Example <?php $record = geoip_record_by_name('192.168.0.1'); if…
-
2
votes2
answers5843
viewsQ: Modal opens superimposed by black background
My modals are opening up under the black bottom, like this: In case I take the z-index:1040 from the code below, the black background: .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0;…
-
4
votes3
answers252
viewsQ: Use of preg_replace invalidates password with SHA1
Was using preg_replace, to avoid SQL Injection: $senha = preg_replace('/[^[:alpha:]_]/', '',$_POST['senha']); When comparing the $senha received by POST with the bank password (using SHA1) they are…
-
2
votes2
answers525
viewsQ: How to pass value to label in modal
I fill in the inputs of my modal as follows: <input type="text" id="txtDescricao" name="txtDescricao" minlenght="4" required> Script: modal.find('.modal-body…
-
2
votes1
answer245
viewsQ: Send data from one modal to another modal
I have a modal call details, I have the following data on it: <input type="text" class="form-control" id="id" name="id" required> <input type="text" class="form-control" id="nome"…
-
2
votes3
answers223
viewsA: Multiple pages with a different id
Change your webconfig to hide the . php extension, notice when I say hide is just hide the . php: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer>…
-
7
votes2
answers3238
viewsQ: Call Modal and Tooltip on the same data-toggle
I have a button that calls a modal like this: <button type="button" data-toggle="modal" data-target="#revisao>Revisao</button> To call a Tooltip is used: <button type="button"…
-
1
votes1
answer170
views -
1
votes1
answer65
viewsQ: Scroll button after swapping css with Jquery
I have the following input: When you click the change button a new input appears: When you click this remove button, the first input appears again, only the button breaks the line and looks like…
-
1
votes3
answers125
viewsQ: Enable/Disable input by id
I have two inputs, by automatically clicking they become readonly, I am doing so: <script> $(document).on('click', '#outros,#txtOutros', function() { $('#outros').attr('readonly', true);…
-
3
votes3
answers2513
viewsA: Can I use "mysql_real_escape_string" on "mysqli_connect" website?
No, do not use! The function mysql_real_escape_string is obsolete. The right thing would be to use: $anything = mysqli_real_escape_string($conexao, $_POST['variavel']);…