Questions tagged as 'foreach'

2
answers

Browse JSON array from PHP

JSON: { "_labels": { "a": "DOLARTODAY", "a1": "DOLAR CUCUTA", "b": "IMPLICITO", "c": "DICOM", "d": "DOLAR BITCOIN", "e": "DIPRO" }, "_timestamp": { "epoch": "1520611865",...
asked by 09.03.2018 / 18:38
2
answers

Doubt about foreach with mysql data

I'm new to php and mysql, I have a database with some fields already created, the idea is to print a ticket like the supermarkets but I want to list the purchased products one by one, so I read that you could use foreach, this it's the code that...
asked by 25.02.2018 / 09:35
0
answers

Structure an HTML calendar created with For cycle that repeats dates obtained from MySQL

The following code corresponds to a For cycle that fills a calendar made with HTML (see the following image). In this case, the events obtained by dates from the DB are shown. Those dates are doubled and try to fix it with an if but it ju...
asked by 07.10.2018 / 06:05
1
answer

Calculate the average in minutes?

I am trying to calculate the average time between the column created_at and updated_at, but I am having problems with the foreach, since it only takes the last value I send it, and ignores all the others. public function tiempo() { $creaci...
asked by 19.07.2018 / 01:17
1
answer

Warning: Invalid argument supplied for foreach () when passing a resultset

   Warning: Invalid argument supplied for foreach () in   C: \ xampp \ htdocs \ course_php \ pdo.php on line 9 My code is: <?php try { $conexion = new PDO('mysql:host=localhost;dbname=curso', 'root', ''); echo "conexion exitos...
asked by 28.09.2018 / 22:10
1
answer

disable option in drop-down list

I have an error in the code I am doing, since it is duplicating the options of a list (agenda) that lasts for 15 minutes. The form records everything very well and when I come with the foreach to disable the drop-off list the time that has al...
asked by 28.08.2018 / 18:51
1
answer

I fail in a project of a course that I am doing

Hello very good I am doing a project and I have found this error:    Notice: Undefined index: registration in   D: \ xampp \ htdocs \ gdlwebcamp \ validate_register.php on line 25       Warning: Invalid argument supplied for foreach () in   ...
asked by 17.05.2018 / 13:05
2
answers

Doubt about else within a foreach

Gentlemen, cordial greetings. Searching, I found on the network a php script that allows me to search for files in a directory, I made an adjustment so that I search only pdf files and show me a link to download it, this works well, but I wou...
asked by 12.11.2018 / 17:29
1
answer

Save result of Array in Mysql

with help I have used the following code that allows me to enter data from an input and that it be separated into 3 different values that I need, which are value, code and serial <?php $datos = "3,5 1401 4145 7854 8454 7458 5152556555 5 140...
asked by 21.09.2018 / 14:18
1
answer

PHP-Reorder Array

I have developed an algorithm in php to reorder an array that I have, the code is as follows: <?php $idescuelas=[4,5,8]; $newalumnos=[]; $sql="SELECT * FROM pruebas_alumno inner JOIN alumnos on pruebas_alumno.id_alumnos=alumno...
asked by 09.05.2018 / 16:45