Questions tagged as 'php'

1
answer

Laravel - Relationship ManyToMany extra columns

I have the following scenario in a database: Tables: User id, name email Company id name UserCompany userid business_id start_date data_termino In this scenario, I need to bring the information...
asked by 16.08.2017 / 18:32
1
answer

Is it possible to create console applications in PHP in Clipper style?

It looks like something from another planet, but I'd like to see a current language doing some old stuff, like a PHP doing a Clipper-style application, one with simple, but very efficient lines. I will not go into merit difficulty or viabilit...
asked by 27.03.2018 / 22:54
1
answer

Organization of classes

I need to create a posts system. I'm having trouble studying class and I'm not sure which one to use: class publicarPost {} class excluirPost {} class curtir {} or class Post { function publicarPost(){} function excluirPost(){} fu...
asked by 25.03.2018 / 07:27
1
answer

How to transform more than one vector into array using the php language?

I have a matriz_caminhos.txt file with 20 rows and 20 columns, I need to access it and get the data as an array. So far, I just got him to scan the file and return me 20 vectors. Follow the code: . <?php $ponteiro1...
asked by 24.03.2018 / 15:00
1
answer

Delete line breaks in an echo in PHP

I have a html / php page that receives data in a textarea and saves it to a mysql database. Sometimes the user uses line break in their text and saves in the good bank. I also have a php page that converts any record to json, link , which...
asked by 28.03.2018 / 01:22
2
answers

Catch text from an input text

I have the following form <form method="POST"> <input id="comentario" type="text" name="comentario" id="comentario"> <input type="submit" name="Comentar" value="Comentar" id="Comentar"> </form> It is necessary to d...
asked by 08.11.2017 / 22:54
1
answer

Is it possible to find 'this' in a foreach?

I have the following script: $arr = [ 10 => [ 'Xa' => 'xA' ], 32 => [ 'Xb' => 'xB' ], 45 => [ 'Xc' => 'xC' ], 78 => [ 'Xd' => 'xD' ] ] foreach($arr as $var){ if($var['...
asked by 08.11.2017 / 16:53
1
answer

Search in multiple tables

Hello, I'm trying to search in 3 different tables, see my code: $buscando = $pdo->query("SELECT * FROM filmes WHERE nome LIKE '%$busca%' AND status='ativo' ORDER BY nome ASC"); The tables would be: animes, films and series. All have the...
asked by 19.08.2017 / 00:25
3
answers

Display array value in php

I am putting values in a array and need to display those values on the side of the titles in the th of a table . I do not want to use a loop to go through the array, I want to access the value by the index. Here is my f...
asked by 19.10.2017 / 14:53
2
answers

Laravel / Eloquent - Undefined variable: idRequest

I have two queries looking at the model. The first one is working normally: $pedidos = Pedido:: orwhere(function($query){ $query->where('user_id', $_SESSION['idUsuario'])...
asked by 20.10.2017 / 19:27