Questions tagged as 'php'

2
answers

Format date GMT Madrid PHP

When entering the variable to obtain the date, I am looking at the log that is left to me by two hours before the current one in Spain. $nowtimename = gmdate('Y-m-d h:i:s \G\M\T', time()); And I need it to be the one we use right now in Spa...
asked by 29.08.2017 / 07:51
2
answers

Insert current date in a mysql table - php

I have a question about inserting the current date in a row into a mysql table in case there is no such record. Example: Insert 2017-10-10 in a row if it does not exist. But insert a new record in case it's another day like tomorrow (2017-10-11)...
asked by 10.10.2017 / 19:25
3
answers

Combine elements in a switch in PHP

Good morning. I'm going through a foreach that runs a series of data and I want to put them in an array in a specific way. What I have so far is this: switch ($mes_registrado){ case "01": $array[1] = "1er Trimestre";...
asked by 13.10.2017 / 15:23
3
answers

PHP - Create a dynamic array based on cycles

I find a big problem, I want to add an array within an array, but I can not find a solution, my code is this: $arrayDetalle = Array(); for($i = 0; $i < $this->contArticulos; $i++){ $arrayDetalle = array( "Nombre" =>...
asked by 06.10.2017 / 21:57
3
answers

How can I get the total sum of a column in a mysql table?

I have a product table and I wanted to do the sum of the row price in php How should I write the code select? Try to do it that way: $consulta="Select SUM(precio) FROM productos"; It does not work. Help.     
asked by 05.09.2017 / 13:41
2
answers

How to add decimals of a Mysql record with php?

I have a small drawback about adding up the total of a field in the database that is of type DOUBLE (6,3) . I have dealt with number_format and money_format. An example is when I'm going to register the field, I put 240 and when I sav...
asked by 26.08.2017 / 00:39
1
answer

How to remove tags from a text in html but keep the attributes in the text

I want to remove the html tags but keep the format that the tags generate in the text. I'm using the strip_tags() function that removes the html tags but it does not leave the format .. For example I have this text in...
asked by 23.08.2017 / 02:42
1
answer

Save textarea line breaks

I'm using php and mysql, I need to replace the line breaks that I put in my textarea by \ n to save it in my database, I wanted to know how I can do this. Thanks!     
asked by 27.10.2017 / 15:02
1
answer

Table of answers with real results

I put a test to some students, I have a software so that they enter with their username and password, they choose one of 5 answers that there is in the page and already that is uploaded to a database. The tables that I have in the database ar...
asked by 19.09.2017 / 13:33
1
answer

Is it advisable to use cookies for an online cart?

Is it advisable to use cookies for an online cart? So far I am using session variables, but when I close the browser, both the session and the items I added to the cart are destroyed.     
asked by 25.09.2017 / 15:42