English 中文(简体)
显示正确结果,但我希望将其限制在相同的价值观上。
原标题:Correct results showing, but I want to limit them to identical values

我的这种询问显示,我的“页数”在动态表格中,但显示所有页数,但我只想限制“页数”以显示其“运动”栏与目前的“运动”栏相匹配。

这是显示数据的问题:

  $counter=1;               $userID=PageDB::getInstance()->get_user_id_by_name($_SESSION[ user ]);              $result=PageDB::getInstance()->get_pages_by_campaign_id($campaignID);
            $i=0;
                while ($row = mysqli_fetch_array($result)):
                 $style = "";
                    if($i%2==0)
    {
        $style =   style="background-color: #EFEFEF" ;
    }
    echo "<tr".$style.">";
                echo "<td>" . htmlentities($row[ pid ]) . "</td>";
                echo "<td>". htmlentities($row[ id ]) . "</td>";
                ?>
                <td>
                <form style="display:none;"></form>
                    <form name="editPage" action="editPage.php" method="GET">
                        <input type="hidden" name="pageID" value="<?php echo $pageID = $row[ pid ]; ?>" />
                        <input type="submit" name="editPage"  value="<?php echo "Page "  . $counter; ?>" style="padding-top:4px; padding-bottom:6px;background:none;border:none; cursor:pointer"/>
                    </form> 
    </td>           
                <?php
                $pageID = $row[ pid ];  
                $counter++;
                $i++;

                echo "</tr>
";
            endwhile;
            mysqli_free_result($result);              
?>   

在这方面,我是如何询问数据库的。

public function get_pages_by_campaign_id($campaignID) {
    $campaignID = $this->real_escape_string($campaignID);
    return $this->query("SELECT pid,campaignid,id,campaign_name FROM pages,campaigns WHERE pages.campaignid = campaigns.id ORDER BY campaigns.id LIMIT 1,10");
    }

As I said it is returning the right data, but I only want to display the data where: pages.campaignid = campaigns.id [1] or pages.campaignid = campaigns.id [r] etc...

问题回答

页: 1 该表将比较目前浏览量是否等于运动。 补贴





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签