Posts by Felipe J. R. Vieira • 575 points
23 posts
-
0
votes2
answers133
viewsA: how to print a list of numbers with an interspersed sum?
This answer answers your problem. List <Long> lista = new ArrayList(); long x=200; long pulo = 3; for (long a = 1; a <= 10; a++) { if((a % pulo) == 0){ lista.add(x+a); }else{ lista.add(a);…
javaanswered Felipe J. R. Vieira 575 -
-1
votes3
answers64
viewsA: Difficulty when mounting SQL query
Select * from tabela where time_azul rlike '([^0-9]|^)5([^0-9]|$)' and time_laranja rlike '([^0-9]|^)5([^0-9]|$)' This meets your need, however your table is poorly modeled. It is interesting that…
-
2
votes1
answer147
viewsA: Logout problem with php
You are using a cookie to log in, however when logging out you are clearing the session variables, so it does not work. You must do the cookie removal.
-
1
votes3
answers7164
viewsA: LEFT JOIN SUBQUERY
From what I understand of your problem, the solution is this:: SELECT a.id, a.nome, count(d.id_categoria) as atualizacoes FROM postagens_categorias as a LEFT JOIN (SELECT id_categoria from…
sqlanswered Felipe J. R. Vieira 575 -
1
votes1
answer99
viewsA: Help with grandfather, father and grandson relationships
There is the method hasManyThrough which enables you to link Form directly to Fill. In the Form model it will be as follows: class Formulario extends Model{ ... public function campo(){ return…
-
0
votes3
answers945
viewsA: Register user with Laravel
The problem with your code is using the Funcionario::create. This method uses Mass Assingment that "blocks" fields and only allows the insertion of fields that are specified in $fillable model. To…
-
4
votes2
answers97
viewsA: How to convert a value (which appears to be octal) to literal string in PHP (5.6)?
When you enter 0 in front of a number, it is considered an octal. The problem is that in the case of values 08 and 09, in versions prior to PHP 7 ignore the rest of the number. From PHP 7 a…
phpanswered Felipe J. R. Vieira 575 -
4
votes1
answer54
viewsA: Why doesn’t this simple code in Haskell compile?
The (+) method works with any type, but it requires the two elements to be of the same type. When he identifies that the first element is an Int, he infers that the other will be as well. For its…
haskellanswered Felipe J. R. Vieira 575 -
0
votes1
answer66
viewsA: You’re not saving in the database
Do the following <?php include_once("conexao.php"); $nome = filter_input(INPUT_POST,'nome'); echo "Nome: $nome <br>"; $telefone =filter_input(INPUT_POST,'telefone'); echo "Telefone:…
-
2
votes1
answer57
viewsA: How to return multiple fields as a single array or string?
You can use the command concat_ws, in the specification, says that uni string according to a separator, better explanation in…
-
0
votes2
answers110
viewsA: Save data from array
To simplify your code, you can do this: <?php require '../../vendor/autoload.php'; use App\Controllers\Controller\Create; $Create = new Create; $campo = filter_input_array(INPUT_POST,…
phpanswered Felipe J. R. Vieira 575 -
0
votes1
answer43
viewsA: How to send SQL data with pre-defined PHP data
You must pass as parameter in pagina1.php the values you want to pass as parameter to página2.php. <center> NOME: <?php echo $nome; ?> | <?php echo $modo; ?> | <a…
phpanswered Felipe J. R. Vieira 575 -
0
votes1
answer99
viewsA: Why do I need to enter the full address? <img src...>
If your HTML page is at the same level as the images folder, in this case inside the Curriculum Vitae folder, you will be able to access the image by src=imagens/hall.jpg or making…
-
0
votes1
answer29
viewsA: Sum of two tables and display of results
$Valor = mysqli_query($conexao,"SELECT (SUM(Y) - SUM(X)) AS Resultado FROM tabela"); if($rs = mysqli_fetch_array($Valor)){ $X = $rs['Resultado']; } That solves your problem.…
-
2
votes1
answer50
viewsA: Problem in using str_replace
You’re concatenating the output of str_replace which is the content with $body altered with its own $body. You must do $body = str_replace('[teste]', $teste, $body );…
phpanswered Felipe J. R. Vieira 575 -
2
votes1
answer238
viewsA: Performing array validation within another array
The if will work properly if you do it the following way: foreach ($items['skin_js'] as $value) { if (( $value["js/tm/ajaxsearch/xregexp-all.js"] != null ) || ($value["js/tm/ajaxsearch.js"] != null)…
-
1
votes2
answers49
viewsA: Controller method getting wrong value in Laravel
Since your route contains two parameters, it is the first parameter that is being injected into your method, in this case, {id_prop}. See the description on the site Route Parameters are Injected…
-
2
votes1
answer1020
viewsA: Group sum by month and year
Solution for Firebird database. select extract(MONTH from dataPagamento) AS MES, extract(YEAR from dataPagamento) AS ANO, sum(valor) from pagamento group by extract(MONTH from…
-
2
votes1
answer93
viewsA: Recover mysql tables name
When writing the list you are displaying the reference to Resultset, not the table name, because in the snippet pedidos.setNomePedidos(rs); you are passing the whole object by parameter. To work,…
-
1
votes2
answers567
viewsA: Insert array into a database using PHP
Do it this way: $topicos = $_POST['campo']; $query = "INSERT INTO reuniao (nm_reuniao,dt_reuniao,nm_criador,nm_topico) VALUES ('$nm_reuniao','$dt_reuniao', '$logado','$nm_topico')"; foreach…
-
1
votes2
answers1580
viewsA: How to submit a POST request without form
The recovery of the values on the other page will be done in the usual way, as if using forms. <?php echo 'Valor1: '.$_POST['field1']; ?> That would be the present code…
phpanswered Felipe J. R. Vieira 575 -
0
votes1
answer55
viewsA: How to send only the quantity of products that were selected in the checkbox?
Instead of using the foreach, you would use a for with a counter $i that would be increased by 1. This $i would go to the value of your checkbox. So you would have its position in your table. Add an…
-
4
votes1
answer109
viewsA: Turn RPG - Character and enemy receive the same attack
The problem with your solution is that the attributes of your Character class are Static. Static attributes are class attributes and not object attributes. Remove the working Static.
javaanswered Felipe J. R. Vieira 575