【问题标题】:how to fix my PHP code or google ads to appear ads between the lines that looped from db如何修复我的 PHP 代码或谷歌广告以在从 db 循环的行之间显示广告
【发布时间】:2019-06-03 10:36:20
【问题描述】:

我有一个网站,Google 批准了我的广告帐户。我的网站有从数据库循环的行。我想把 Goo 广告的每一行都放在fieldset 标签内

while ($row = mysqli_fetch_array($result)) {
 echo "<fieldset>
my row here
</fieldset>";

}

例如:

<fieldset1>
my row here from DB
<endfieldset1> 

<fieldset2>
GOOGLE ADS 
<endfieldset2>

<fieldset3>
my row here from DB
<endfieldset3>

 <fieldset4>
my row here from DB
<endfieldset4>

【问题讨论】:

  • 向我们展示您的实际代码,而不是伪代码。

标签: php html mysqli ads


【解决方案1】:

这是一个相当愚蠢的解决方案,但它可能适用于你想要的。

<?php

    $counter = 0;
    while ($row = mysqli_fetch_array($result)) {

        // Echo your normal stuff here

        if ($counter == 5) {
            // Echo your add here and reset the counter
            $counter = 0;
        }

        $counter++;

    }

?>

所以一旦计数器到达者 5 显示您的添加并将其重置为 0

【讨论】:

    猜你喜欢
    • 2022-08-20
    • 1970-01-01
    • 1970-01-01
    • 2013-10-03
    • 1970-01-01
    • 2011-10-16
    • 1970-01-01
    • 1970-01-01
    • 2011-04-13
    相关资源
    最近更新 更多