Questions tagged as 'foreach'

1
answer

How to use for each in arrays array?

Having the arrays array: int matriz[][] = new int[1][1] How do I use the for each (for (int count: array)) to traverse its rows and columns?     
asked by 20.05.2015 / 05:19
1
answer

How to print values of this type of array

This is the xml used to generate the array <?xml version="1.0" encoding="utf-8"?> <integracao> <status>2</status> <resposta> <paginacao> <totalItens>2&l...
asked by 04.09.2014 / 20:41
1
answer

Error when using SqlCommand and foreach

I'm trying to navigate a list of objects and persist their data in SqlServer: foreach (var item in pedidos) { cmd.CommandText = "INSERT INTO MinhaTabela (Coluna_A, Coluna_B, Coluna_C) " + "VALUES (@Val_A, @Val_B, @Val_C)"; c...
asked by 20.11.2017 / 13:54
1
answer

Forearch loop how to use with controler

I have 6 PictureEdit in a PanelControl , and I need to run a haul on all PictureEdit so I made the following code: foreach (PictureEdit Pic in panel1.Controls) { //habilita o meno de zoom Pi...
asked by 21.05.2017 / 13:08
1
answer

Foreach without repeating the name

I have a Foreach in View, and it contains Description, qtd and dta, how do I make a foreach without repeating the description? Ex: I have a product X whose 10 units were removed on 10/1/2016, 3 units on 04/10/2016, 8 units on 10/15/2016, how do...
asked by 18.10.2016 / 07:07
1
answer

Capture results using HtmlAgilityPack

I am using this code to search results using the Html Agility Pack. It looks like this: WebRequest request = WebRequest.Create(texto); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(respons...
asked by 19.07.2016 / 22:17
2
answers

Array of unique values with foreach

I have the following foreach to get the id of the devices that were used in each sector: @foreach($relatorio->Empresa->SetorEmpresa as $setor) {{ $collection[] = $setor->SetorEmpresaEdificacao->id_aparelho_ruido }} @endfo...
asked by 11.05.2016 / 19:43
1
answer

Read data in a SQL with columns of equal names in different tables

I need to retrieve data from 2 tables. My SQL shown below works perfectly. The problem is that I made a foreach to retrieve the data from the second table by the ID field that is conflicting with the first table since both ha...
asked by 14.11.2015 / 00:53
2
answers

Read string json in php

I need to read the file below: string '{"object":"list","hasMore":true,"limit":10,"offset":0,"data":[{"city":{"object":"city","id":15873,"ibgeCode":"3550308","name":"São Paulo","districtCode":"00","district":"São Paulo","state":"SP"}},{"city...
asked by 07.11.2015 / 21:25
2
answers

How to get the values of an array from a key

I need to get the values ($ src), within this foreach, of each key separately in that array: <?php foreach( get_post_gallery( $post->id, false ) as $key => $src ) { echo $key; //resultado: link, size - ids - src...
asked by 06.11.2015 / 19:05