Question: this is my code:

```
$q=mysqli_query($idcon,"SELECT * FROM `subscribed-team`");
while($row=mysqli_fetch_array($q)){

    if($row['id-team']==$_POST["teamm"]){
        if($row['year-st']==$_SESSION["year"]){

            $p=mysqli_query($idcon,"SELECT * FROM `subscription`");

            while($row1=mysqli_fetch_array($p)){
                if($row1['id-subs']==$row['id-subs'])
                    echo"<img src='".$row1[8]."'/>";
            }
        }
    }
}

```

now this code works fine, but it echo my results on the same line since its a loop.

i want my output to be 3 photos per line for example: 
image1 image2 image3 (jumps to line)
image4 image5 image6
and not:
image1 image2 image3 image4 image5 image6.
To be more precise i want to add a condition that when the loop reaches 3 values, it returns to a new line and continue printing the results.

Answer: 
**Hint**

You have a lot of problem in your code :

* `y` is not define in your main method
* The `i` is already declared in your method, so you have not
to declare it again in your loop `(int i = 0;)` just use it `(i = 0;)`.
* Your miss `;` in the end of `y = (i/2)`
* When you make `;` in the end of your loop, the next block
will not executed `for(int i = 1; i <= 20; i++ );`
* You have to `return(y)` in the end of your method not in your
loop

---

Correct this typos and your code will compiled, another thing you never call your method HalfOfInt so don't wait to get information from this method, you have to call in your main method.

---

Edit

Your code in this case should look like this:

```
public static void main(String[] args) {
    for (int i = 1; i <= 20; i++) {
        System.out.println(i + "-" + HalfOfInt(i));
        //                              ^-----------call your method which
                                                  //take an int and return the (i/2)
        //                 ^-------------------------Print your value
    }
}

public static double HalfOfInt(int i) {
    return (double) i / 2;//<<----------- no need to use a loop just return (i/2)
}

```
**Multiple Problems** : 

1. There is a `;` after your `for` loop.
2. `y` is **not** defined in your main method.
3. You are missing a `;` after `y = (i/2)`
4. You never call `HalfOfInt`
5. You declare `i` twice.

Also, you should stick with Java naming conventions. Methods should begin with a *lower-case letter*.