title: PHP/mySQL get_file_contents and update the column
body: <p>I have a mySQL db table. One of the table columns contains URLs which point to different xml files on a remote server. </p>
  
  <p>My goal is to read each URLs info and write the xml content into another column on the same record (line) respectively.</p>
  
  <p>In my PHP code, I am able to get the URL correctly from mySQL database and I am able to get the XML content on remote server into a variable correctly. </p>
  
  <p>But the issue is while I write the content to my table line by line. Some XML columns got update correctly and some XML columns are empty. </p>
  
  <p>I am pretty sure each time the variable got content correctly because I am able to print out each individual content on screen. </p>
  
  <p>Why are some content updating the column and some don't. All the XML strings have the same format. If I copied that content and updated the mysql table manually, it successfully wrote into the table.</p>
  
  <p>At beginning I thought it was time issue so I add enough sleep time for my PHP code. it does't help. then I suspected my db datatype, so I changed the XML
  column data type from VCHAR to TEXT and even LONGTEXT. it does't help either. Does any one have a clue? </p>
  
  <p>part of my php code below... </p>
  
  <pre><code>$result = mysqli_query($con,"SELECT url_txt FROM mytable ");
  
  //work with result line by line:
  while($row = mysqli_fetch_array($result)) {
  
  echo  $url_content = file_get_contents($row['url_txt']);
  
  //debug line below *******************************/
   echo $URL=$row[url_txt]; 
  //debug line above********************************/
   mysqli_query($con,"UPDATE mytable SET xml_info='$url_content' where url_txt = '$URL' "); 
  
     }
  </code></pre>