How does pdomysql output 1st million data records and 4th million data records?

Source: Internet
Author: User
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 ..

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.