Questions tagged as 'php'

3
answers

Auto Load classes in PHP

I'm developing a mini framework to use in my applications and auto-load classes like this: function __autoload($Class) { $cDir = ['Conn', 'Helpers', 'Models']; $iDir = null; foreach ($cDir as $dirName): if (!$iDir &&a...
asked by 04.09.2016 / 16:34
1
answer

Downloading Files in PHP

I have an application in PHP and a URL of a file. I would like that when the user clicks on any button, cause the browser to trigger the action to download or open the download options window of that file (in the case of Firefox). The file ca...
asked by 19.02.2016 / 21:20
4
answers

Correct way to use the abs function of php

What is the correct way to use this function? 1st: $limite = \abs($resultado_cadastro->limite); 2º: $limite = abs($resultado_cadastro->limite); Both work, but netbeans says that the correct one is \abs     
asked by 19.05.2016 / 14:36
2
answers

How to include a js from another domain in html?

Hello, I have an .js file in link . I would like to call it in another location (mydomain2.com) with <script src="meudominio.com/arquivo.js" ></script> , however, gives file not found. And the name is correct and I can access...
asked by 03.03.2016 / 20:22
3
answers

Get the first 3 results in a mysql_query query

I'm retrieving data from the database that would be "The Indicator of the Indicated", but it catches all up to retrieve all. What I need to do is get only the first 3 results. And if I tell you how many results I want to get, that is, set thi...
asked by 15.01.2016 / 03:43
1
answer

Convert database field divided into commas in separate variables with PHP

How can I convert database results that are within a field divided by commas, into separate variables independently of the number of results contained in the field. Example: I have: $row['campo'] = 333,444,555,6666 I need: $var1='33...
asked by 21.03.2016 / 15:39
1
answer

UTF-8 character problem

With an error on my site, in% of UTF-8 If I use á it will pro link as %E3%83%E2%A1 and printa in input as %e3%83%e2%a1 in hosting. But in localhost it goes as ã¡ and returns as %c3%a3%c2%a1 . The...
asked by 16.04.2016 / 21:32
1
answer

Extract name and last name mysql

Good morning Guys, how do I extract the name and last name of a record. However, it should return the first and last name when it has only one last name. My table is like this.    table = 'users'; field1 = 'name';   field2 = 'sobronome';...
asked by 02.06.2016 / 15:43
2
answers

Set values inside or outside the method?

I'm studying about passing parameters in PHP. I want, for example, to use a certain method that needs to get two values, I have the following codes: Example 1 In class : class Exemplo { protected $var1, $var2; publ...
asked by 27.05.2016 / 17:59
3
answers

AJAX - Appear divs

How do I get a div in return of AJAX , for example: I write in the input a user, and sends the data by AJAX like this: $("#botao").click(function(){ var xprocesso = $("#segundo").val(); $.post('aquirecebe.php',{...
asked by 01.05.2016 / 02:32