【发布时间】:2015-06-22 16:29:28
【问题描述】:
我已经在创建页面学校和广告
这个页面是这样显示的
学校 1 - 学校 2 - 学校 3
广告1
学校 4 - 学校 5 - 学校 6
广告2
学校 7 - 学校 8 - 学校 9
广告默认
但我在搜索 1 所学校时遇到了问题 这所学校没有显示,我知道这所学校没有显示,因为结果查询不是乘以 3 数据。如果我的查询结果是 1 或 2 个数据。此页面未显示此结果,因为此结果不是多个 3 数据。
这是我的网站:http://www.tingali.com/pencarian.html
您可以搜索并输入“MA AL KARIMIYAH”
这是我的脚本: pagging_page3.php
<?php
include('connection.php');
$limit = 24;
$adjacent = 3;
if(isset($_REQUEST['actionfunction']) && $_REQUEST['actionfunction']!=''){
$actionfunction = $_REQUEST['actionfunction'];
call_user_func($actionfunction,$_REQUEST,$con,$limit,$adjacent);
}
function showData($data,$con,$limit,$adjacent){
$page = $data['page'];
$dt = $_POST['dt'];
if($page==1){
$start = 0;
}
else{
$start = ($page-1)*$limit;
}
$sqlo = "select * from schools where showschool='YES' ".$dt." and typeschool='school' order by paid,urut asc";
$sql = stripslashes($sqlo);
$rows = $con->query($sql);
$rows = $rows->num_rows;
$sqlo = "select * from schools where showschool='YES' ".$dt." and typeschool='school' order by paid,urut asc limit $start,$limit";
$sql = stripslashes($sqlo);
$data = $con->query($sql);
$str='';
$i=0;
$k=0;
$m =1;
$rumus = $page * ($limit / $adjacent); // bntr
$data_web = mysqli_query($con,"SELECT * from web");
$wew = ($page - 1) * 8;
$row2 = mysqli_fetch_object($data_web);
while($row = $data->fetch_array(MYSQLI_ASSOC)){
// This Data Ads
if($i % 3 == 0)
{
$data_ads = mysqli_query($con,"SELECT * from ads limit $wew,1");
$rowads = mysqli_fetch_object($data_ads);
$str = is_null($rowads->link) ? "<a href='#'><img src='images/ads/default/default.jpg' alt=''></a>":"<a href='".$rowads->link."'><img src='images/ads/default/".$rowads->file."' alt=''></a>";
$wew++;
}
// This Data School
$jd = $row['link'];
$data_sl = mysqli_query($con,"SELECT count(kode) as counter FROM `school_counter` where kode ='".$row['kode']."' and visit between '".$row2->range_start."' AND '".$row2->range_end."' ");
$sl = mysqli_fetch_object($data_sl);
$str.=" <li class='col-lg-4 col-md-4 col-sm-4 col-xs-4'>
<div class='product_item'>
<div>
<a href='".$jd."'>
<img height='228px' width='224px' src='images/sekolah/logo/".$row['logo']."' class='c_image_1' alt=''>
</a>
</div>
<div class='product_info'>
<a href='".$jd."'><h4>".$row['name_school']."</h4></a>
<div class='clearfix'>
<font size='2' color='blue'>Dilihat : ".$sl->counter." </font></br>
<i class='fa fa-home'></i> : ".$row['addres']."<br/>
</div>
</div>
</div>
</li>
";
$i++;
if ($i%3 == 0) {
echo $str;
}
}
?>
帮帮我谢谢
【问题讨论】:
-
请至少将帮助请求限制在特定的代码段中,不要只是粘贴应用程序并希望有人愿意涉足它。
-
完成,我更新了这段代码
-
这是一件非常危险的事情,即通过 $_POST/$_GET 传入一个函数名,然后在没有任何验证的情况下使用它!?!?!?!
-
只搜索数据学校:(