Questions tagged as 'foreach'

1
answer

Invalid argument supplied for foreach () Using JSON

I'm trying to loop through foreach with an array populated in JSON. To facilitate I'm testing via $ _GET (but I already tested with array populated by php itself but did not work). $ _GET looks like this: $amigos = json_decode($_GET['amigos'])...
asked by 06.06.2016 / 23:58
0
answers

PHP / Bootstrap - Repeat until X and then until Y then adds new DIV and continues the replay

I'm breaking my head in this repetition, as this is my first question, sorry for the mistakes. :) I'm currently with this code block inside the container: <?php echo '<div class="row">'; $posts = DBRead('posts', "WHE...
asked by 07.08.2015 / 15:50
0
answers

Foreach inside if Cakephp

I have a table A that stores an item, and in this table, I have a related table B that can have multiple items added to an item in table A. Follow if code: if ($this->ClientePagamento->save($valor_pagar)) { $this->Sessi...
asked by 06.07.2015 / 17:10
1
answer

Foreach within While

Capture in an array the values received via checked checkbox post, these checkboxes have the values equal to the field names of the table, I need to query with while and print the fields referring to array: <?php $campos = '''.implode('...
asked by 22.05.2015 / 03:48
0
answers

Receive all data from a table with just one query

I'm trying to create a system that uses images from LastFM. But I want to show only the images of the artists registered in the bank. I did so: I made a query of the bank with condition that banda_id was not null. I created a foreach to...
asked by 02.03.2015 / 02:21
2
answers

Multidimensional array in C # equal to PHP?

First time here in this forum, I usually use stack overflow but come on. My question is about array in C #: I'm more familiar with PHP and in php we can name our array indexes for example: $array = ["nome"=>"Pedro", "Idade"=>18]; M...
asked by 20.08.2016 / 05:53
3
answers

Compare and replace index array

The problem is the following, I'm creating daily OS graphs, only coming from the day bank in English, I would like to replace each index with the Portuguese value My code public function osSemanal($id_company) { $periodo = date...
asked by 11.12.2017 / 18:03
2
answers

Browse JSON - AngularJS

I have the following object: { "_id" : ObjectId("5a0ae1a032e3762988cddb11"), "numeroBo" : NumberInt(4), "relato" : "aaaa", "modus" : "bbb", "falhasApuradas" : "aaaa", "eventosDeRisco" : [ ], "acoesCriminosas" : [ ], "alertas" : [...
asked by 14.11.2017 / 13:44
3
answers

array in a php foreach

I will try to be objective in the doubt: I have the following code: <?php foreach ($modelo as $k => $v) { $sql_ = "SELECT * FROM pedido WHERE modelo LIKE '%".$v."%' ORDER BY id ASC"; $disp_sql_ = $mysqli->query($sql_);...
asked by 25.09.2018 / 19:23
2
answers

How to sort and list only 5 items in a list?

Well, I'm developing the dashboard of a web system, in one of the filters I should list the top 5 clients and sort them by the highest amount of totals of invoices issued. I'm already able to list quietly, the problem is that the filter is listi...
asked by 24.05.2018 / 20:37