How does pdomysql output 1st million records and 4th million data records? How does mysql output 7th million records and 1st million data records ..
Below is the output of all data ..
query($sql1); while($row = $rs -> fetch()) { echo''.$row[id].'
'; } ?>
Reply to discussion (solution)
query($sql1); $num = 0; while($row = $rs -> fetch()) { $num++;if(1==$num || 4==$num || 7==$num) echo''.$row[id].'
'; }
?>
query($sql1);$flag = 1;while($row = $rs -> fetch()){ if(($flag-1)%3 == 0){ echo''.$row[id].'
'; } $flag++;}
It should be okay without testing.
$pdo = new PDO("mysql:host=localhost;dbname=uzhan","root",""); $sql1="select * from www"; $rs = $pdo -> query($sql1); while($row = $rs -> fetch()){ $i = 1;if($i % 3 ==1){ echo''.$row[id].'
'; } $i = $i + 1;}
That shows 2, 5, 8, and 11 ..
Display 3 6 9 .... I am not very good at algorithms.
If the error message is displayed, the value is 1, 5, 9, and 13 ..
2 6 10 15 ..
3 7 11 16 ..
4 8 12 17...
4 ..