title: mysqli_fetch_array to php variable trash
body: <p>I upload 4 photos in a folder, and the names of the photos on mysql. Then i "SELECT" the names of the files, and put them in the array picArray as shown. But when i try to echo the contents, although i take the right names, it seem that they cant be used as a directory path.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>                $con=mysqli_connect("localhost","root","mypass","fixit");
                  $con-&gt;set_charset("utf8");
                  $repId=$repId+1;
                  $qr = mysqli_query($con,"SELECT * FROM photos WHERE report='$repId'");
  
  
                  $picArray = Array();
  
                  while( $row = mysqli_fetch_array($qr) ) {
                      $picArray[] = $row['name'];
                  }   
  
          ?&gt;      
  
              &lt;div&gt;
                  &lt;img  id="img1" src="uploads/&lt;?php echo $repId ?&gt;/&lt;?php echo $picArray[0] ?&gt;" /&gt;
                  &lt;img  id="img2" src="uploads/&lt;?php echo $repId ?&gt;/&lt;?php echo $picArray[1] ?&gt;" /&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;img  id="img3" src="uploads/&lt;?php echo $repId ?&gt;/&lt;?php echo $picArray[2] ?&gt;"  /&gt;
                  &lt;img  id="img4" src="uploads/&lt;?php echo $repId ?&gt;/&lt;?php echo $picArray[3] ?&gt;"  /&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>What i should mention, is that when i:</p>
  
  <pre><code>echo $picArray[0];
  echo $picArray[1];
  echo $picArray[2];
  echo $picArray[3];
  </code></pre>
  
  <p>i get: </p>
  
  <pre><code>rafiki.png rafiki2.png
  rafiki3.pngrafiki4.png 
  </code></pre>
  
  <p>which means that the array has newline and spaces on it... Why is this happening?</p>