Questions tagged as 'php'

5
answers

Why does NetBeans warn you that you should not access global variables directly?

NetBeans suggests that we do not access the global variables of PHP type $_SERVER[''] directly, what is the suggestion in this case? It's usually done like this: <?php $ip = $_SERVER["REMOTE_ADDR"]; ?> What is the best...
asked by 23.12.2015 / 13:32
1
answer

Problems with a MYSQL query - Categories and Items

I'm doing a project, which basically consists of item and category ... or rather "animes" and "episodes" ... Here's the problem, I want to list all the registered anime and a count of episodes related to them, for example. "Katekyo - 24 episo...
asked by 27.02.2015 / 17:48
2
answers

Why is the path not recognized by Silex when there is a slash "/" at the end of the requested url?

I'm starting my MVC studies with silex today, but I'm having trouble creating routes by accessing addresses containing a slash at the end. Example: http://site.com.br/home/ I have already been able to access the url only in the http://si...
asked by 31.10.2014 / 20:23
2
answers

PHP: Upload file

I'm here with a problem uploading an XML file in PHP. I have a form that allows me to select a file: <form id="upload" action='' method='post' enctype="multipart/form-data" > <input id='uploaded_file' type='file' name='uploade...
asked by 12.05.2014 / 18:52
2
answers

I know the value of the variable, but the switch only goes to the default

After a search, I get the following result: // O resultado desta linha é I ou II ou III; echo $subsecao; // O resultado desta linha é string; echo gettype($subsecao); // Faço um switch p...
asked by 22.04.2015 / 14:55
1
answer

How to retrieve via Ajax query result variables in PHP?

I made a query via Ajax which returned the variables within PHP : // Variaveis $nome = $Fetchi['nome']; $email = $Fetchi['email']; $tipo = $Fetchi['tipo']; $senha = "Digite uma nova senha..."; $ativado = $Fetch...
asked by 03.08.2014 / 14:52
4
answers

Identifying snippets in two PHP strings

I need to make a non-standard string comparison in PHP. I have 2 strings as below: $primeira = 'asdasdasdTESTEasdasdasdasd'; $segunda = 'lkijlikjTESTEilkjik'; How do I dynamically know if the first and second variables contain the same seq...
asked by 25.09.2014 / 20:39
3
answers

Best way (s) to use Dependency injection in Laravel

What is the best way to use Injection of dependence in laravel? The one I was using was this: public function __construct(Cliente $clientes, Telefone $telefones){ $this->clientes = $clientes; $this->telefones = $telefones; } F...
asked by 30.01.2014 / 13:41
3
answers

Format city names and ignore words such as "do", "of", "of", "of", "etc

I'm working with Webservice whose city names are all deformatted, and I'd like to create a function to treat the names evenly. An example is this: PORTO DE GALINHAS I would like it to look like this: Porto de Galinhas I would hav...
asked by 27.12.2015 / 22:02
2
answers

Remove empty positions from an array

I'm passing array via GET to PHP and then sending to the client side (JavaScript). When I get it it looks like this: m_prod = [5,,,,,,,,6,,,,,,]; In other words, it is including a space in the positions that do not contain a v...
asked by 19.11.2014 / 15:47