title: Store MySQL data in text file, create new file automatically if the number of rows exceeds 100
body: <p>I am storing my database output in a .txt file. I am not having any problems, but I just want to store 100 rows of MySQL data in one .txt file and the rest in other text files with 100 rows in each file.</p>
  
  <p>Here is my code which is generating all data in only one text file.</p>
  
  <pre><code>&lt;?php 
    $File = "yourfile.txt"; 
  
    $Handle = fopen($File, 'w');
    $res = mysql_query("SELECT * from tableA");
  
    while ($row = mysql_fetch_array($res)) {
      $oumu .= ''.$row4['title'].'';
    }
  
    $Data = $oumu; 
    fwrite($Handle, $Data); 
    print "Data Added"; 
    fclose($Handle); 
  ?&gt;
  </code></pre>
  
  <p>It puts all data in one text file but I want to store only 100 rows in one text file and I want to automatically create the next file so that it can store 100 rows in each text file.</p>