jeudi 9 avril 2015

Looping total not same in database

Hello i have a script looping php, and each loop 4 data/row then show ads.


but i have a problem.. because in database i have data 123 row. but in show in php only 92 row/data :'(


this is my script



<?php
include "connection.php";
$i=0;
$data_school=mysql_query("select * from school");
while ($school=mysql_fetch_object($data_school))
{
if($i%4==0)
{
echo "<br/><a href='#'><img src='ads.jpg' alt=''></a><br/>";
}
else
{
echo $school->name_school"<br/>";
}
$i++;
}
?>


when i run in browser, and ads show but school only show "92 row/data"


if i remove script



if($i%4==0)
{
echo "<br/><a href='#'><img src='ads.jpg' alt=''></a><br/>";
}


then script be like this



<?php
include "connection.php";
$i=0;
$data_school=mysql_query("select * from school");
while ($school=mysql_fetch_object($data_school))
{
echo $school->name_school"<br/>";

$i++;
}
?>


this data show all 123 row/data


help me, i want like this


school 1


school 2


school 3


school 4


#ads


school 5


school 6


school 7


school 8


#ads


Help me, Thank's


Aucun commentaire:

Enregistrer un commentaire