Questions tagged as 'php'

1
answer

Open a view with Codeigniter on a different page

I would like to open a view on another browser tab using Codeigniter, does anyone know how to do it? In% w / o "a href" I use the tag property to achieve. How do I pass this property on target=_blank     
asked by 08.02.2017 / 16:14
2
answers

How to leave a negative number in php?

I have a rating of "A" and "B". If it's "A", I want the number to always be positive, if it's "B" I want it to always be negative. I'm using a code in this logic: if($classificacao==="A") $sinal="abs"; elseif($classificacao==="B")...
asked by 12.07.2017 / 14:35
1
answer

What is the function of the __wakeup magic method in php?

I read the documentation, but it was not very clear. __wakeup() reestablishes the connection to the database? For example, I have a script that runs for a long time, there is an hour when the connection to the bank that was opened is...
asked by 07.02.2017 / 23:41
3
answers

Read Array out of foreach

In this script below I read an array inside the foreach, but how can I read it off? when I give an echo it only returns me 1 id $data = unserialize ($linha["range_ids"]); // a:3:{i:1052;s:4:"1052";i:1053;s:4:"1053";i:1054;s:4:"1054";} for...
asked by 19.10.2015 / 17:49
4
answers

how to return an error after submitting a form?

How do I return echo "Deu Erro!" ? on my page? // page-2.php <form method="post" id="formulario" action="acoes/enviar-formulario.php"> //codigo aqui </form> Within enviar-formulario.php there is an update: $...
asked by 07.10.2015 / 14:59
1
answer

Autoload class PSR4

I would like to create a autoload class that follows the PSR4 recommendations and can be used independently of the Composer autoload >. The application I'm creating will have the following structure: /root |--/src...
asked by 08.10.2015 / 23:26
1
answer

Capture two parts of the same string?

I have a list of names that follow this structure: Diretoria: (aprovação 23, de 2014) Diretoria: (aprovação 42, de 2015) Diretoria: (aprovação 70, de 2016) How do I capture numbers separately and put them each in span ? to look like t...
asked by 18.10.2016 / 23:20
1
answer

Make a SELECT COUNT (*) FROM table

Make a (SELECT COUNT('id') FROM 'imagem') , take this value and pass it as a parameter in a function. How do I? <?php require("Configs/connection.php"); ?> <!doctype html> <html lang="en"> <head>...
asked by 27.10.2016 / 22:06
2
answers

Validate domain preg_replace

My question is as follows, I have the following function: $site = preg_replace("/[^a-zA-Z0-9]/", "", $_POST['site']); But when using the string www.lostscavenge.com , this regular expression issues the following return:   wwwlostscavenge...
asked by 15.01.2017 / 23:48
1
answer

Return an PDO query in an array

How do I make a query with PDO and return the results in a array . Ex: I need to make a query that returns 10 rows, each row has 3 columns <?php $equipe1 = $_POST['equipe1'];//Pega o Nome da equipe $equipe2 = $_POST ['equip...
asked by 21.01.2017 / 01:23