[Solved] PHP Get 2 data rows in single iteration [closed]

First get all data into an array. Then compose that array multidimensional array. So you can push two rows in every single key something like that. while($row = mysql_fetch_assoc($query)){ $data[] = $row; } $last_data = array(); $key = 0; for($i=0;$i<sizeof($data);$i++) { if($i%2 == 0) { $key++; } $last_data[$key][] = $data[$i]; } Then you can iterate … Read more

[Solved] Iterate over list

You need to break up the rows and convert each value to an integer. At the moment you are looking for the presence of the string “3” which is why strings like “2;13” pass the test. Try something like this: list_6 = [“4;99”, “3;4;8;9;14;18”, “2;3;8;12;18”, “2;3;11;18”, “2;3;8;18”, “2;3;4;5;6;7;8;9;11;12;15;16;17;18”, “2;3;4;8;9;10;11;13;18”, “1;3;4;5;6;7;13;16;17”, “2;3;4;5;6;7;8;9;11;12;14;15;18”, “3;11;18”, “2;3;5;8;9;11;12;13;15;16;17;18”, “2;5;11;18”, “1;2;3;4;5;8;9;11;17;18”, … Read more

[Solved] Python Error with iteration, for loop

Please look at the formatting tips, it will help you display your code as you wish. that said, I think this is what you want. The following code will iterate through each character in your list string. If it finds a match, it will print success list = “9876554321” for char in list: if char … Read more

[Solved] What is the use of iter in python?

First of all: iter() normally is a function. Your code masks the function by using a local variable with the same name. You can do this with any built-in Python object. In other words, you are not using the iter() function here. You are using a for loop variable that happens to use the same … Read more