Posts by Eduardo Henrique • 124 points
15 posts
-
0
votes1
answer189
viewsQ: Create another class or not? PHP/POO
My question is the following: I have two tables and classes of finance, one for Despesas and another to Receitas. The two have some identical columns and some different ones. I need to use a method…
-
1
votes1
answer114
viewsA: Input Spaces in Twiter Bootstrap
Add the following to a custom css sheet: .form-group { margin-bottom:10px; margin-right:-10px; } I advise using it in a custom css sheet and not in the bootstrap pattern. If you update the bootstrap…
-
2
votes2
answers2375
viewsQ: Sum the total value of two columns, subtract, and return even if negative Mysql
I have this following query: SELECT FORMAT(SUM(receitas_dia) - SUM(despesas_dia),2,'de_DE') AS saldo_efetivo FROM (SELECT SUM(r.valor_receita) AS receitas_dia, (SELECT SUM(d.valor_despesa) FROM…
mysqlasked Eduardo Henrique 124 -
0
votes1
answer396
viewsQ: Pass PHP variable to another page using Ajax, and update value of an element
I have the following code gerar-relatorio-extrato.php: try { $pdo = abrirConexao(); // Selecionar extrato $consultaExtrato = $pdo->prepare($sql); $consultaExtrato->execute($insertData);…
-
0
votes2
answers288
viewsQ: Sum the total value of a given column for each table - Mysql
I have the following query: SELECT FORMAT(valor,2,'de_DE') AS valor, DATE_FORMAT(data_vencimento, '%d/%m/%Y') AS data_vencimento, realizado, DATE_FORMAT(data_realizado, '%d/%m/%Y') AS…
-
1
votes2
answers558
viewsQ: List two distinct tables and filter by Mysql data - PHP
My problem is that I need to list values from two different tables, and I’m using a filter to add conditions in the query. For example: if(!empty($mes_especifico)) { $sql .= "AND…
-
1
votes1
answer88
viewsQ: What’s wrong with this query?
I am wanting to subtract the total value of a column from a table, with the total value of a column from another table. Query: SELECT ( SUM(r.valor_receita) - ( SELECT SUM(d.valor_despesa) FROM…
mysqlasked Eduardo Henrique 124 -
0
votes3
answers49
viewsA: Error query by date
Try it this way: tblacesso.HorarioSaida >= '2017-06-17 00:00:00' AND tblacesso.HorarioSaida <= '2017-06-17 23:59:59'
-
0
votes1
answer59
viewsQ: Simplify subtraction between Mysql tables
I would like to know how to simplify the following: SELECT FORMAT((SUM(r.valor_receita) - (SELECT SUM(d.valor_despesa) FROM despesas AS d WHERE d.pago = 1 AND YEAR(r.data_vencimento) <=…
-
2
votes1
answer1338
viewsQ: Calculate Mysql percentage
I’m looking for a percentage calculation. Taking the value that was received in that selected month (received = 1), divide by the total value of that selected month, and multiply by 100 to return…
-
0
votes1
answer227
viewsA: Insert multiple PHP PDO values
I was able to replace the loop for while: while ($n < $parcelas) { $insertQuery[] = "(:valor_despesa".$n.", :data_vencimento".$n.", :pago".$n.", :data_pagamento".$n.", :importante".$n.",…
-
0
votes1
answer227
viewsQ: Insert multiple PHP PDO values
I want to insert multiple values in the table, for each portion quantity informed. It’s all right, working though.. I need that every loop the due date has the month added up. The code below:…
-
0
votes2
answers245
viewsA: Update table attribute, via Form <?php $PHP_SELF ? >
I’ve come to this result... <? if(isset($_POST['reseta_wl'])) { $id = $_SESSION['s_usuario']; $result = mysql_query("select * from game where id = '$id'"); $usr = mysql_fetch_array($result);…
-
2
votes2
answers245
viewsQ: Update table attribute, via Form <?php $PHP_SELF ? >
I tried to make a code here, but it didn’t go very well... they know to inform me where the error is? <? if(isset($_POST['reseta_wl'])) { $dbhost = '127.0.0.1'; $dbuser = 'root'; $dbpass = '';…
-
1
votes0
answers731
viewsQ: Data insertion - Foreign keys in Java
I’m having a little trouble implementing the foreign keys in my project. Daoproduct.java. public class DAOProdutoImpl implements DAOProduto { private GerenciadorDeConexao gc; public…