0

Hello i want to make to show adds but on every 10th ticket i have tried with for loop but its adding too much adds here is the code:

if($is_active == 1 && $is_shared == 1) {
                        for($i=0; $i <= 1; $i++) {
                            echo "<table id='t01' style='margin: 5px;'><tr><th colspan='2'>Publisher: $publisher <img src='like-btn.png' width='21' height='21' style='position: responsive; cursor: pointer; align='right'> 0</img></th></tr>";
                            echo "<tr><th colspan='2'>Ticket ".$count." | <a style='font-size: 12px;'>Date: ".$date."</a></th></tr>";
                            echo "
                                    <tr><td>".$row["match1"]."</td><td>".$row["tip1"]."</td></tr>
                                    <tr><td>".$row["match2"]."</td><td>".$row["tip2"]."</td></tr>
                                    <tr><td>".$row["match3"]."</td><td>".$row["tip3"]."</td></tr>
                                    <tr><td>".$row["match4"]."</td><td>".$row["tip4"]."</td></tr>
                                    <tr><td>".$row["match5"]."</td><td>".$row["tip5"]."</td></tr>
                                    <tr><td>".$row["match6"]."</td><td>".$row["tip6"]."</td></tr>
                                    <tr><td>".$row["match7"]."</td><td>".$row["tip7"]."</td></tr>
                                    <tr><td>".$row["match8"]."</td><td>".$row["tip8"]."</td></tr>
                                    <tr><td>".$row["match9"]."</td><td>".$row["tip9"]."</td></tr>
                                    <tr><td>".$row["match10"]."</td><td>".$row["tip10"]."</td></tr>
                                    <tr><td>".$row["match11"]."</td><td>".$row["tip11"]."</td></tr>
                                    <tr><td>".$row["match12"]."</td><td>".$row["tip12"]."</td></tr>
                                    <tr><td>".$row["match13"]."</td><td>".$row["tip13"]."</td></tr>
                                    <tr><td>".$row["match14"]."</td><td>".$row["tip14"]."</td></tr>
                                    <tr><td>".$row["match15"]."</td><td>".$row["tip15"]."</td></tr>
                                    <tr><td>".$row["match16"]."</td><td>".$row["tip16"]."</td></tr>
                                ";
                            echo "<tr><th colspan='2'>Total Bet: $uplata_total</th></tr>";
                            echo "<tr><th colspan='2'>Total Win: $dobivka_total</th></tr>";
                            echo "<tr><th colspan='2'>Odds: $odd</th></tr>";
                            echo "</table>"; 
                            ?>
                            <div id="banner">
                                <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
                                    <!-- SecoundAd -->
                                    <ins class="adsbygoogle"
                                    style="display:inline-block;width:710px;height:100px"
                                    data-ad-client="ca-pub-5699416235054188"
                                    data-ad-slot="7054710957"></ins>
                                    <script>
                                    (adsbygoogle = window.adsbygoogle || []).push({});
                                </script>
                            </div>
                            <?php 
                            $count++;
                        }
                    }
2
Contributors
4
Replies
20
Views
2 Years
Discussion Span
Last Post by Stefan_1
0

Your for loop gets repeated only two times. Did you mean you want to display an ad every 10th match?

0

yeah something like that on every 10th Ticket

Edited by Stefan_1

0

I am not sure if I understood you right, but I'll give it a go.

Firstly I think you do not need a $count variable since you have $i for counting. Then you just check the value of $i whether the remainder of the integer division with 10 is 0. If yes, display the banner:

<?php if($i % 10 == 0): ?>
    <div id="banner">
        <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
            <!-- SecoundAd -->
            <ins class="adsbygoogle"
            style="display:inline-block;width:710px;height:100px"
            data-ad-client="ca-pub-5699416235054188"
            data-ad-slot="7054710957"></ins>
            <script>
            (adsbygoogle = window.adsbygoogle || []).push({});
        </script>
    </div>
<?php endif;

Edited by broj1

0

Thank you very much btw the count variable is for counting the tickets as they are shared..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.