title: Replacing content of block after generating clones using cloneBlock - PHPWord
body: <p>Please can somebody be so kind to show me the syntax for using cloneblock in phpword.</p>
  
  <p>So Ive got data in a MySQL DB, and for the single rows that I need to import into my word doc via phpword it works fine....to run my query and search and replace with template processor. BUT, now I want to insert multiple rows into my word document. I've researched and found that the cloneblock method is the answer. However I cannot get it working....currently my code runs but it doesn't seem to get to the second row. </p>
  
  <p>I actually dnt get any error messages. My code executes fine...but the end display word file doesn't display fine....and if you see my code I got an echo statement...which echo's out in my browser exactly what I want "damaged" &amp;"good", (as an example given of one of the row data) but that data doesn't get pulled into my word doc like that...it duplicates "damaged" , "damaged". .</p>
  
  <pre><code>$group_key=1;
  
  do {    
  
    //loop to increase my uuid  - ($repeatgroup')
    $repeatgroup = $id."/"."trailer_repeat_group"."[".$group_key."]";
  
  // query string
    $trailer_repeat_grouping = mysqli_query($connect, "SELECT * FROM trailer_repeat_group LEFT JOIN main on trailer_repeat_group.PARENT_KEY = main.metainstanceID WHERE trailer_repeat_group.KEY_id = '$repeatgroup'");
  
    $templateProcessor-&gt;cloneBlock('CLONEME', $trailer_count);
  
    while ($row1 = mysqli_fetch_array($trailer_repeat_grouping)) {    
  
      //this echo below I am using to test exactly what happends – independent of 
      //PHPword/templateprocessor
      echo $rttc =  $row1['right_trailer_tyre_condition'];
  
      //inserting  / searching / inserting values
      $templateProcessor-&gt;setValue("right_trailer_tyre_condition", $rttc);
    }
  
    // ending of loop / checking loop
  
    $group_key++;
  
  } while ($group_key &lt;= $trailer_count);
  </code></pre>