Questions tagged as 'foreach'

3
answers

Displaying data in a table with foreach

I'm having problems on the results page, others are working correctly, the purpose is to print the approval or disapproval of the students in the table using foreach in PHP. Error:    Warning: Invalid argument supplied for foreach...
asked by 06.03.2015 / 19:13
4
answers

PHP / Codeigniter error "Array to string conversion"

I made a foreach to add values to an insert but suddenly there was a strange Array to string conversion error and I have no idea what that is. public function distribuicaoprodutos(){ $filiais=json_decode($_POST['filiais'],TRUE);...
asked by 18.02.2014 / 15:41
2
answers

Can you use a variable that is inside the for?

For example. I'm working with Heredoc and whenever I need to do a for , I have to close Heredoc to do the for then reopen the tag mentioned. Is there any way to query a variable within the for which will return all results to me? For examp...
asked by 06.06.2014 / 00:16
2
answers

How to put paging in foreach that returns a JSON list with ajax

I call this function that returns me a list and populates a table in the view, updating every time I pass a parameter through the filter. Everything works perfectly, I just need to put paging because it has search that returns more than 100 line...
asked by 28.03.2018 / 18:52
1
answer

How to use foreach with this type of JSON (PHP)

I'm trying to display the values of a JSON with PHP most unsuccessfully. Used Code: JSON { "friendslist": { "friends": [ { "steamid": "76561197960265731", "relationship": "friend",...
asked by 29.12.2015 / 20:53
2
answers

How to show multiple error messages simultaneously in form?

I'm trying to make my registration page show all messages from forgotten fields together like in this example: Butitonlyshowsinparts:1-"Username already exists" and "Email already exists" or 2 - "Please insert a username", "Please insert...
asked by 23.05.2014 / 16:50
1
answer

Map returning repeated values

I am making a foreach in hashmap based on the following arquivo.txt : chaveA;6 chaveA;4 chaveB;3 chaveB;7 chaveC;1 chaveC;1 chaveD;5 For the time being my code looks like this: Scanner scanArquivo = new Scanner(new Fil...
asked by 30.12.2018 / 19:22
1
answer

error foreach codeigniter

I have the following problem, I make a select in the database and display the images on the page, it is a classified portal where the person makes an ad and can upload up to 10 images . So far so good, I get the ad and it is displayed on th...
asked by 08.11.2016 / 19:27
1
answer

Is there a way to use a foreach of a query within a function

I have a simple query : $Consulta = $pdo->query(" SELECT * FROM dados ")->fetchAll(); foreach ($Consulta as $key) { echo $key["InfoDado"]; } If you run foreach out of a function! beauty! It works as it should! But I t...
asked by 04.09.2016 / 22:22
1
answer

How to complement these queries to get the buyer's data in the bank?

I made these queries below to get the data from the buyer's database and the products he bought. With the first query, I took the ID of the requests and with these IDS I made a new foreach that took the products that each ID acquire...
asked by 22.01.2016 / 11:52