Questions tagged as 'php'

3
answers

Error connecting to php server

I'm getting the error trying to connect to the database. configuration.php class Connection { private static $connection = null; public static get() { if (self::$connection == null) { self::$connection = mysqli_connect("...
asked by 29.07.2018 / 15:29
1
answer

How to add a custom font in TCPDF?

I'm using TCPDF to generate PDFs (obvious) and need to add a custom font. I took a look at documentation and it says there is a method called addTTFfont . The problem is, when I try to call, an error is returned, saying that...
asked by 31.10.2018 / 13:20
3
answers

How to generate multiple inputs within a loop of repetition

I need to create inputs based on the amount the user types. For example: var quantidade = 5; \\usuario digitou for(int i = 0; i< quantidade; i++){ //aqui vem os inputs } In this case I would also need to change the name...
asked by 02.11.2018 / 01:35
3
answers

Divide value with random numbers

I have a value that I need to divide it into non-equal parts with several numbers. eg, if I get the number 100, it could generate 20,30,10,20, 5, 15 = 100 The problem is that my code is wrong, the program hangs, it does not leave the numbe...
asked by 17.11.2018 / 17:27
3
answers

Regular expression, PHP

What is the correct way to validate the string for the nomenclature below, using regular expression? /filmes/todos-filmes/notas-espectadores/?page=[SÓ NUMEROS]     
asked by 22.01.2017 / 23:44
2
answers

PHP - List the files in a directory [duplicate]

I have more than a thousand pages in html , I would like my script below to list all the files in a directory instead of being manually uploaded, today I have to do a one . It's not viable! Please see the code below: <?p...
asked by 13.01.2017 / 20:58
2
answers

Divide values in Brazilian currency (R $) in php?

I need to divide the value 6999.99 by 3, but when dividing it returns 2333.00 or does not return the cents, a hypothetical example follows: $parcelas = 3; $valor = double(6.999,99); //já usei com e sem double e na mesma $valorTotal = number_fo...
asked by 16.01.2017 / 19:05
1
answer

Transfer and sum values from an SQL column

I have two columns in a table, I need the values in column 1 to be transferred and added to the values in column 2. Can this be done with a PHP or is there some easier way to do it? Original: ID / 1 / 2 / 1 150 100 2 200 50 3...
asked by 06.08.2015 / 23:29
2
answers

Count number of files in folder

I'm creating a list of images contained within a folder, but I would like to count the amount of files inside the folder, how do I? Here is the code I'm using: <?php $pasta = 'imagens/'; $arquivos = glob("$pasta{*.jpg,*.JPG,*.png,*.gif,*....
asked by 18.07.2015 / 00:51
2
answers

Convert milliseconds to 16-digit hexadecimal

I am implementing an algorithm to generate a key access to a certain system, however the need to convert a numeric value to 16-digit hexadecimal. Consider the number of milliseconds since January 1, 1970: $milliseconds = (time()*1000); //15...
asked by 05.07.2018 / 01:38