Questions tagged as 'php'

1
answer

Query to database

I'm working with someone else's code, it's a mix of structured programming, POO, MVC. Inside a file task_model.php I have two methods, the first getTareasPendientes applies filters and makes the query with the database to throw the...
asked by 01.08.2017 / 18:23
3
answers

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 43624344 bytes)

I get this error when I go through a for with the results of a sql: $datos = serialize($res); $html = ""; for($i = 0; $i < count($res);$i++){ $html = $html.'<form action="exportarTxartelak...
asked by 22.05.2017 / 15:52
2
answers

Error downloading zip from PHP

Good! I'm trying to make a download of a zip file from the server, but when I start the download, it gets stuck ending up as failed. - As a data, when I change the file type to plain and download a txt any, download and ope...
asked by 27.09.2016 / 16:04
1
answer

Error with the file paths in PHP when doing require ()

I am working with PHP and a problem has arisen that I have been looking for and I have not been able to solve. The problem comes when in a class I try to require another class in this way: require 'DAO/usuario.php'; But when it comes to the...
asked by 02.03.2017 / 09:52
1
answer

Current url and url origin php [duplicated]

How can I get with php the url current where the script is running? Is it possible to obtain what is the url of origin if there is one? Example: If the url is: https://es.stackoverflow.com/posts/76245/edit...
asked by 06.06.2017 / 12:08
1
answer

Convert php date

I have the following date: "11-07-2017" day / month / year I need to convert it to "yy / mm / dd" to insert it into the mysql bd I have tried with this without results: $date = 11-07-2017; date_format($date,'Y-m-d'); I get this error:...
asked by 03.07.2017 / 23:06
2
answers

Problems to consult PHP night data

I have the following query to show the average temperature and relative humidity of the last two nights from the current date: SELECT DATE(date) AS Fecha, ROUND(AVG(temperature),2) AS Temperatura, ROUND(AVG(humidity),2)...
asked by 29.09.2016 / 14:25
2
answers

Go through an Array with a PHP Rand

I have 4 buttons which must have options (unique options, that is, they can not be repeated) The options are in a bd of mysql, and everything works fine except that the options are repeated The other functions that I have are so that the s...
asked by 07.08.2016 / 23:49
1
answer

can session_start () be used in constructors of various classes?

I have a big doubt about security, I'm using session_start() as follows: public function validar() { session_start(); if(@$_POST) { foreach($_POST as $campo => $valor) { $asig = "$" . $campo . "='" . html...
asked by 11.08.2016 / 15:42
1
answer

Allow special characters such as @ #% & - + () / * "':;!? | ~ {} [] _ in password

What regular expression can I use to allow characters like these @#%&-+()/*"':;!?~|{}[]_ in php?     
asked by 03.07.2016 / 08:00